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:
@@ -2,12 +2,13 @@ import type { AttendeeListItem, AttendanceStatus } from '@gruperly/shared'
|
||||
import { RECENT_ATTENDANCE_LIMIT } from '@gruperly/shared'
|
||||
import { PAYMENT_DUE_SOON_DAYS } from './constants'
|
||||
|
||||
/* La fila del listado no pide al backend juicios de presentación: pide los
|
||||
datos crudos (últimas clases, cobro vigente) y de acá sale el texto. Los
|
||||
días que faltan cambian según cuándo se mira, así que no pueden venir
|
||||
guardados desde el servidor. */
|
||||
/* The listing's row does not ask the backend for presentation verdicts: it asks
|
||||
for the raw data (recent classes, current charge) and the text comes from
|
||||
here. The days remaining change depending on when you look, so they cannot
|
||||
come stored from the server. */
|
||||
|
||||
/** Días calendario entre dos fechas, sin horas: "vence el día 10" no tiene hora. */
|
||||
/** Calendar days between two dates, without times: "due on the 10th" has no
|
||||
* time of day. */
|
||||
function calendarDaysBetween(from: Date, to: Date): number {
|
||||
const startOf = (date: Date) =>
|
||||
new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime()
|
||||
@@ -20,15 +21,15 @@ export type PaymentState =
|
||||
| { kind: 'overdue'; days: number }
|
||||
|
||||
/**
|
||||
* Qué hay que marcarle al cobro en la fila.
|
||||
* What to mark on the charge in the row.
|
||||
*
|
||||
* Devuelve `null` cuando no hay nada que avisar: o el miembro no tiene ningún
|
||||
* cobro registrado, o el que tiene vence más adelante que la ventana de aviso y
|
||||
* todavía no venció. No es lo mismo que "al día", que es un pago cerrado.
|
||||
* Returns `null` when there is nothing to warn about: either the attendee has no
|
||||
* recorded charge, or the one they have is due later than the warning window and
|
||||
* has not expired yet. That is not the same as "ok", which is a closed payment.
|
||||
*
|
||||
* Un `PENDING` con vencimiento ya pasado cuenta como vencido, igual que un
|
||||
* `OVERDUE`: el estado guardado suele quedarse en PENDING hasta que alguien lo
|
||||
* actualiza a mano y la fila no puede depender de esa disciplina.
|
||||
* A `PENDING` whose due date has already passed counts as overdue, same as an
|
||||
* `OVERDUE`: the stored state often stays at PENDING until someone updates it by
|
||||
* hand, and the row cannot depend on that discipline.
|
||||
*/
|
||||
export function resolvePaymentState(
|
||||
payment: AttendeeListItem['payment'],
|
||||
@@ -57,7 +58,7 @@ export function paymentStateLabel(state: PaymentState): string {
|
||||
case 'settled':
|
||||
return 'Al día'
|
||||
case 'dueSoon':
|
||||
// "Vence en 0 d" no es español de persona: hoy y mañana tienen palabras.
|
||||
// "Vence en 0 d" is not natural Spanish: today and tomorrow have words.
|
||||
if (state.days === 0) return 'Vence hoy'
|
||||
if (state.days === 1) return 'Vence mañana'
|
||||
return `Vence en ${state.days} d`
|
||||
@@ -67,20 +68,20 @@ export function paymentStateLabel(state: PaymentState): string {
|
||||
}
|
||||
|
||||
export type AttendanceSummary = {
|
||||
/** Estados a dibujar, del más antiguo al más reciente. */
|
||||
/** States to draw, from the oldest to the most recent. */
|
||||
dots: AttendanceStatus[]
|
||||
attended: number
|
||||
recorded: number
|
||||
/** "Sin clases aún" cuando no hay nada registrado. */
|
||||
/** "Sin clases aún" when nothing is recorded. */
|
||||
label: string
|
||||
}
|
||||
|
||||
/** Los últimos puntos de clase registrados, contados sobre esa misma ventana. */
|
||||
/** The last recorded class points, counted over that same window. */
|
||||
export function summarizeAttendance(
|
||||
recentAttendance: AttendanceStatus[],
|
||||
): AttendanceSummary {
|
||||
// La ventana la fija el backend; el corte final evita que una fila se alargue
|
||||
// si el contrato llegara con más clases de las previstas.
|
||||
// The window is set by the backend; the final cut prevents a row from getting
|
||||
// longer if the contract ever delivers more classes than expected.
|
||||
const dots = recentAttendance.slice(-RECENT_ATTENDANCE_LIMIT)
|
||||
const recorded = dots.length
|
||||
|
||||
@@ -97,7 +98,7 @@ export function summarizeAttendance(
|
||||
}
|
||||
}
|
||||
|
||||
/** Orden alfabético fijo del listado. */
|
||||
/** The listing's fixed alphabetical order. */
|
||||
export function byFullName(a: AttendeeListItem, b: AttendeeListItem): number {
|
||||
return a.fullName.localeCompare(b.fullName, 'es', { sensitivity: 'base' })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user