feat: Added unchecked room highlighting

This commit is contained in:
2025-06-03 13:24:02 +02:00
parent d50aa79c5d
commit b7c84fbe14
2 changed files with 9 additions and 4 deletions

View File

@@ -25,14 +25,14 @@ class Attendence {
this.attendence.delete(room) this.attendence.delete(room)
} }
getRoom (room: string) { getRoom (room: string): IAttendence | undefined {
return this.attendence.get(room) return this.attendence.get(room)
} }
summary () { summary () {
var summary: {room: string, hours: string[], notes: string}[] = [] var summary: {room: string, hours: string[], notes: string, auto: boolean}[] = []
this.attendence.forEach((v, k) => { this.attendence.forEach((v, k) => {
summary.push({room: k, hours: v.auto.map(i => i.hour), notes: v.notes}) summary.push({room: k, hours: v.auto.map(i => i.hour), notes: v.notes, auto: false})
}) })
return summary return summary
} }

View File

@@ -88,7 +88,12 @@ cleanRouter.delete('/attendence/:room', async (req, res) => {
}) })
cleanRouter.get('/attendenceSummary', async (req, res) => { cleanRouter.get('/attendenceSummary', async (req, res) => {
res.send(attendence.summary()) var allRooms = usettings.settings.rooms
var graded = (await Grade.find({date: new Date().setUTCHours(24,0,0,0)})).map(v => v.room)
var ungraded = allRooms.filter(x => !graded.includes(x))
var summary = attendence.summary()
var unchecked: typeof summary = ungraded.filter(x => !summary.map(v => v.room).includes(x)).map(v => ({room: v, hours: [] as string[], notes: "Nie sprawdzono", auto: true}))
res.send([...summary, ...unchecked])
}) })
export {cleanRouter} export {cleanRouter}