forge
Explore
Log in

Don't you dare go Hollow

✅ roll call leads with Present and says when students are done

Browse files at this commit

6e42004f2e288c4650f8e1aaecc2901d397090d4Burak BoduroğluParent: 321d831
  • style
    • ✅ roll call leads with Present and says when students are done
Show full message
style: ✅ roll call leads with Present and says when students are done
- checked on real data (10-B, 9 rows): the school's status order put
  "Var" last, the one a teacher taps most; it now leads every row, the
  rest keep the school's order
- with no student left unmarked the bulk button read as live in the dark
  theme even at half opacity; it turns outline and reads "Tüm öğrenciler
  işaretli"
src/components/sessions/session-roll-call.tsxmodified+12 -5
@@ -36,9 +36,12 @@ export function SessionRollCall(props: {
3636 }) {
3737 const t = useT();
3838 const [settings] = createResource(() => getSettings());
39- const statuses = createMemo<AttendanceStatus[]>(
40- () => settings.latest?.attendance_statuses ?? ATTENDANCE_STATUSES.map((item) => item.value),
41- );
39+ // The school's statuses in its own order, except "present" leads: it is
40+ // the one a teacher taps most, so it sits first on every row.
41+ const statuses = createMemo<AttendanceStatus[]>(() => {
42+ const list = settings.latest?.attendance_statuses ?? ATTENDANCE_STATUSES.map((item) => item.value);
43+ return list.includes("present") ? ["present", ...list.filter((status) => status !== "present")] : list;
44+ });
4245 const [attendance] = createResource(
4346 () => props.sessionId,
4447 async (sessionId) => (await getSessionAttendance(sessionId)).items,
@@ -76,6 +79,7 @@ export function SessionRollCall(props: {
7679 }
7780 return tally;
7881 });
82+ const studentsLeft = createMemo(() => unmarked().filter((target) => !target.isTeacher).length);
7983 const visibleTargets = createMemo(() => (onlyUnmarked() ? unmarked() : targets()));
8084
8185 const setBusy = (userId: string, busy: boolean) =>
@@ -193,14 +197,17 @@ export function SessionRollCall(props: {
193197 <Button
194198 type="button"
195199 size="sm"
200+ variant={studentsLeft() > 0 || bulk() ? "default" : "outline"}
196201 class="h-9 rounded-lg"
197- disabled={!ready() || bulk() != null || unmarked().filter((target) => !target.isTeacher).length === 0}
202+ disabled={!ready() || bulk() != null || studentsLeft() === 0}
198203 onClick={() => void markRestPresent()}
199204 >
200205 <IconCheck class="h-4 w-4" />
201206 {bulk()
202207 ? t("rollCall.marking", { done: bulk()!.done, total: bulk()!.total })
203- : t("rollCall.markRestPresent")}
208+ : studentsLeft() > 0
209+ ? t("rollCall.markRestPresent")
210+ : t("rollCall.studentsDone")}
204211 </Button>
205212 <Button
206213 type="button"
src/i18n/messages.tsmodified+3 -0
@@ -633,6 +633,7 @@ export type MessageKey =
633633 | "today.upcoming"
634634 | "rollCall.progress"
635635 | "rollCall.markRestPresent"
636+ | "rollCall.studentsDone"
636637 | "rollCall.marking"
637638 | "rollCall.onlyUnmarked"
638639 | "rollCall.allMarked"
@@ -2799,6 +2800,7 @@ const en: Dict = {
27992800 "today.upcoming": "Not started",
28002801 "rollCall.progress": "{marked} of {total} marked",
28012802 "rollCall.markRestPresent": "Mark the rest present",
2803+ "rollCall.studentsDone": "Every student is marked",
28022804 "rollCall.marking": "Saving {done} of {total}…",
28032805 "rollCall.onlyUnmarked": "Only unmarked",
28042806 "rollCall.allMarked": "Everyone is marked.",
@@ -4967,6 +4969,7 @@ const tr: Dict = {
49674969 "today.upcoming": "Başlamadı",
49684970 "rollCall.progress": "{total} kişiden {marked} işaretlendi",
49694971 "rollCall.markRestPresent": "Kalanları Var işaretle",
4972+ "rollCall.studentsDone": "Tüm öğrenciler işaretli",
49704973 "rollCall.marking": "{total} kişiden {done} kaydedildi…",
49714974 "rollCall.onlyUnmarked": "Yalnızca işaretlenmemişler",
49724975 "rollCall.allMarked": "Herkes işaretlendi.",