forked from wangziqi/gongxue-base
feat: settle course attendance automatically
This commit is contained in:
@@ -63,3 +63,22 @@ export function summarizeAttendance(records: readonly { status: string }[]): Att
|
||||
}
|
||||
return summary;
|
||||
}
|
||||
|
||||
export interface LessonCheckinSummary {
|
||||
total: number;
|
||||
checkedIn: number;
|
||||
notCheckedIn: number;
|
||||
}
|
||||
|
||||
export function summarizeLessonCheckins(
|
||||
records: readonly { status: string }[],
|
||||
): LessonCheckinSummary {
|
||||
const checkedIn = records.filter(
|
||||
(record) => record.status === 'present' || record.status === 'late',
|
||||
).length;
|
||||
return {
|
||||
total: records.length,
|
||||
checkedIn,
|
||||
notCheckedIn: records.length - checkedIn,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user