chore: update comments and documentation for clarity and consistency across various files
- Translated comments from Spanish to English in vite.config.ts, docker-compose.yml, attendance-risk.ts, analytics.ts, attendance.ts, attendees.ts, enums.ts, groups.ts, and onboarding.ts. - Improved descriptions for better understanding of code functionality and purpose. - Ensured uniformity in terminology and phrasing throughout the codebase.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import type { AttendanceHistoryItem } from '@gruperly/shared'
|
||||
|
||||
/* El endpoint de historial corta en 20 sesiones (HISTORY_SESSIONS_LIMIT en el
|
||||
backend). Es el techo real de lo que esta pantalla puede mostrar, así que
|
||||
"Ver todas" no promete más de lo que hay. */
|
||||
/* The history endpoint cuts off at 20 sessions (HISTORY_SESSIONS_LIMIT on the
|
||||
backend). It is the real ceiling on what this screen can show, so "Ver todas"
|
||||
does not promise more than there is. */
|
||||
export const HISTORY_PREVIEW = 5
|
||||
export const HISTORY_LIMIT = 20
|
||||
|
||||
@@ -29,9 +29,9 @@ export function attendanceStatusLabel(status: AttendanceSession['status']): stri
|
||||
}
|
||||
}
|
||||
|
||||
/* El estado se lee por texto e ícono, no solo por color: los tokens de estado
|
||||
están pensados como texto sobre superficies oscuras y el verde sobre blanco
|
||||
queda justo por debajo de AA, así que la fila lleva las tres señales. */
|
||||
/* The status is read through text and icon, not color alone: the status tokens
|
||||
are meant as text over dark surfaces and the green on white sits just below
|
||||
AA, so the row carries all three signals. */
|
||||
export function attendanceStatusClass(status: AttendanceSession['status']): string {
|
||||
switch (status) {
|
||||
case 'PRESENT':
|
||||
@@ -45,7 +45,7 @@ export function attendanceStatusClass(status: AttendanceSession['status']): stri
|
||||
}
|
||||
}
|
||||
|
||||
/** "28 sep 2026". Es la fecha corta de siempre: entra en una línea en móvil. */
|
||||
/** "28 sep 2026". It is the usual short date: it fits on one line on mobile. */
|
||||
export function formatMemberSince(iso: string): string {
|
||||
return new Date(iso).toLocaleDateString('es-MX', {
|
||||
day: 'numeric',
|
||||
@@ -59,9 +59,9 @@ export function classCountLabel(count: number): string {
|
||||
return count === 1 ? '1 clase' : `${count} clases`
|
||||
}
|
||||
|
||||
/** Lo que se muestra: de la más reciente a la más antigua, con las últimas
|
||||
* `HISTORY_PREVIEW` como vista previa. El endpoint devuelve el orden
|
||||
* contrario (más antigua → más reciente). */
|
||||
/** What is displayed: from the most recent to the oldest, with the last
|
||||
* `HISTORY_PREVIEW` as the preview. The endpoint returns the opposite order
|
||||
* (oldest → most recent). */
|
||||
export function visibleSessions(
|
||||
sessions: AttendanceSession[],
|
||||
showAll: boolean,
|
||||
@@ -70,26 +70,27 @@ export function visibleSessions(
|
||||
return showAll ? ordered : ordered.slice(0, HISTORY_PREVIEW)
|
||||
}
|
||||
|
||||
/** Clases con asistencia registrada: asistió, faltó o faltó con aviso. Las
|
||||
* "Sin registrar" no cuentan: sin dato no hay ni asistencia ni ausencia, y
|
||||
* meterlas en el denominador hacía que "1 de 3" se leyera como dos ausencias. */
|
||||
/** Classes with a recorded attendance: attended, was absent or was absent with
|
||||
* notice. The "Sin registrar" ones do not count: without a record there is
|
||||
* neither attendance nor absence, and putting them in the denominator made
|
||||
* "1 de 3" read as two absences. */
|
||||
function markedSessions(sessions: AttendanceSession[]): AttendanceSession[] {
|
||||
return sessions.filter((session) => session.status != null)
|
||||
}
|
||||
|
||||
export type AttendanceSummary = {
|
||||
/** "1 de 1 clase", o "Sin clases registradas" si no hay ninguna con dato. */
|
||||
/** "1 de 1 clase", or "Sin clases registradas" if there is none with a record. */
|
||||
label: string
|
||||
/** "2 sin registrar", o `null` si no hay clases sin registro. */
|
||||
/** "2 sin registrar", or `null` if there are no classes without a record. */
|
||||
unmarkedLabel: string | null
|
||||
}
|
||||
|
||||
/** Resumen de las filas que se están mostrando: cuántas clases registró la
|
||||
* persona sobre cuántas hay con dato, y cuántas quedaron sin registrar.
|
||||
/** Summary of the rows being shown: how many classes the person recorded out of
|
||||
* how many have a record, and how many were left unmarked.
|
||||
*
|
||||
* El texto de las "sin registrar" se apaga cuando no hay ninguna clase
|
||||
* registrada: el resumen ya dice que no hay datos y los dos textos dirían lo
|
||||
* mismo dos veces. */
|
||||
* The "sin registrar" text is dimmed when there is no marked class: the summary
|
||||
* already says there is no data and the two texts would say the same thing
|
||||
* twice. */
|
||||
export function attendanceSummary(sessions: AttendanceSession[]): AttendanceSummary {
|
||||
const marked = markedSessions(sessions)
|
||||
if (marked.length === 0) return { label: 'Sin clases registradas', unmarkedLabel: null }
|
||||
|
||||
Reference in New Issue
Block a user