some hot fixes

This commit is contained in:
Nathan 2025-09-30 18:17:07 +02:00
parent 1b2458bc60
commit 796c568834
2 changed files with 5 additions and 11 deletions

View file

@ -11,7 +11,6 @@ import { inject } from '@adonisjs/core'
import app from '@adonisjs/core/services/app'
import env from '#start/env'
import User from '#models/user'
import { DateTime } from 'luxon'
import redis from '@adonisjs/redis/services/main'
@inject()
@ -96,16 +95,10 @@ export default class AuthController {
}
}
const lastYear = DateTime.now().minus({ years: 1 })
// TODO: const lastYear = DateTime.now().minus({ years: 1 })
return User.query()
.select('firstName', 'lastName', 'id')
.where('className', className)
.whereExists((query) => {
query
.from('colles')
.whereRaw('colles.student_id = users.id')
.where('colles.date', '>=', lastYear.toISODate())
})
.orderBy('lastName', 'asc')
.then((users) => {
return {

View file

@ -57,6 +57,7 @@ export default class CollesController {
.where('subjectId', colle.subjectId)
.where('date', colle.date.toISO()!)
.where('id', '!=', colle.id) // Exclude the current colle
.where('examinerId', colle.examinerId)
.whereHas('student', (query) => {
query.where('className', auth.user!.className)
})
@ -186,9 +187,9 @@ export default class CollesController {
parseFloat(beforeColle.grade)
)
}
if (!deepEqual(beforeColle, afterColle)) {
await this.notificationService.sendNotification('COLLE_UPDATED', existing)
}
// if (!deepEqual(beforeColle, afterColle)) {
// await this.notificationService.sendNotification('COLLE_UPDATED', existing)
// }
return existing.save()
}
const colle = await Colle.create(colleData)