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:
@@ -18,11 +18,11 @@ export function normalizePhone(rawPhone: string): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsea texto CSV con soporte para:
|
||||
* - Delimitadores automáticos (coma, punto y coma, tabulador)
|
||||
* - Comillas y comillas escapadas ("")
|
||||
* Parses CSV text with support for:
|
||||
* - Automatic delimiters (comma, semicolon, tab)
|
||||
* - Quotes and escaped quotes ("")
|
||||
* - UTF-8 BOM
|
||||
* - Saltos de línea CRLF o LF
|
||||
* - CRLF or LF line breaks
|
||||
*/
|
||||
export function parseCsvContent(content: string): string[][] {
|
||||
const cleanContent = content.replace(/^\uFEFF/, '');
|
||||
@@ -30,7 +30,7 @@ export function parseCsvContent(content: string): string[][] {
|
||||
|
||||
if (lines.length === 0) return [];
|
||||
|
||||
// Detectar delimitador basado en la primera línea
|
||||
// Detect the delimiter from the first line
|
||||
const firstLine = lines[0];
|
||||
const commaCount = (firstLine.match(/,/g) || []).length;
|
||||
const semicolonCount = (firstLine.match(/;/g) || []).length;
|
||||
@@ -56,7 +56,7 @@ export function parseCsvContent(content: string): string[][] {
|
||||
if (char === '"') {
|
||||
if (insideQuote && line[i + 1] === '"') {
|
||||
currentCell += '"';
|
||||
i++; // Saltear comilla escapada
|
||||
i++; // Skip the escaped quote
|
||||
} else {
|
||||
insideQuote = !insideQuote;
|
||||
}
|
||||
@@ -75,8 +75,8 @@ export function parseCsvContent(content: string): string[][] {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsea un archivo XLSX de Excel extrayendo sharedStrings y sheet1.xml
|
||||
* utilizando DecompressionStream nativo del navegador sin dependencias externas.
|
||||
* Parses an Excel XLSX file by extracting sharedStrings and sheet1.xml with
|
||||
* the browser's native DecompressionStream, without external dependencies.
|
||||
*/
|
||||
export async function parseXlsxContent(buffer: ArrayBuffer): Promise<string[][]> {
|
||||
const view = new DataView(buffer);
|
||||
@@ -112,7 +112,7 @@ export async function parseXlsxContent(buffer: ArrayBuffer): Promise<string[][]>
|
||||
entries.set(fileName, new Uint8Array(decompressed));
|
||||
}
|
||||
} catch {
|
||||
// Ignorar archivos que no se puedan descomprimir
|
||||
// Ignore files that can't be decompressed
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ export async function parseXlsxContent(buffer: ArrayBuffer): Promise<string[][]>
|
||||
offset = dataStart + compressedSize;
|
||||
}
|
||||
|
||||
// Parsear strings compartidos
|
||||
// Parse the shared strings
|
||||
const sharedStringsData = entries.get('xl/sharedStrings.xml');
|
||||
const sharedStrings: string[] = [];
|
||||
if (sharedStringsData) {
|
||||
@@ -138,7 +138,7 @@ export async function parseXlsxContent(buffer: ArrayBuffer): Promise<string[][]>
|
||||
}
|
||||
}
|
||||
|
||||
// Parsear sheet1.xml
|
||||
// Parse sheet1.xml
|
||||
const sheetData = entries.get('xl/worksheets/sheet1.xml');
|
||||
if (!sheetData) {
|
||||
throw new Error('No se pudo encontrar la hoja de cálculo principal en el archivo Excel.');
|
||||
@@ -174,7 +174,7 @@ export async function parseXlsxContent(buffer: ArrayBuffer): Promise<string[][]>
|
||||
}
|
||||
|
||||
/**
|
||||
* Normaliza una matriz 2D en objetos de contactos con detección inteligente de columnas.
|
||||
* Normalizes a 2D matrix into contact objects with smart column detection.
|
||||
*/
|
||||
export function normalizeRowsToContacts(rawRows: string[][]): ParsedContactRow[] {
|
||||
if (rawRows.length === 0) return [];
|
||||
@@ -219,7 +219,7 @@ export function normalizeRowsToContacts(rawRows: string[][]): ParsedContactRow[]
|
||||
}
|
||||
}
|
||||
|
||||
// Fallbacks posicionales si no se detectaron encabezados explícitos
|
||||
// Positional fallbacks when no explicit headers were detected
|
||||
if (!hasHeader) {
|
||||
firstNameCol = 0;
|
||||
lastNameCol = 1;
|
||||
@@ -230,7 +230,7 @@ export function normalizeRowsToContacts(rawRows: string[][]): ParsedContactRow[]
|
||||
}
|
||||
|
||||
if (phoneCol === -1) {
|
||||
// Buscar la primera columna que parezca un número telefónico
|
||||
// Look for the first column that looks like a phone number
|
||||
for (let c = 0; c < (rawRows[1]?.length ?? 0); c++) {
|
||||
const sample = rawRows[1][c];
|
||||
if (/^[\d\s+\-()]{6,}$/.test(sample)) {
|
||||
@@ -291,7 +291,7 @@ export function normalizeRowsToContacts(rawRows: string[][]): ParsedContactRow[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Descarga una plantilla de ejemplo en formato CSV para la carga masiva.
|
||||
* Downloads a sample template in CSV format for the bulk upload.
|
||||
*/
|
||||
export function downloadAttendeeTemplateCsv() {
|
||||
const csvContent =
|
||||
|
||||
Reference in New Issue
Block a user