system message guardados en historial por sala
This commit is contained in:
@@ -30,6 +30,7 @@ interface RoomDetail {
|
||||
gameStatus?: string;
|
||||
variant?: string;
|
||||
round?: number;
|
||||
systemMessages?: Array<{ text: string; kind: string; timestamp: number }>;
|
||||
}
|
||||
|
||||
const props = defineProps<{ rooms: any[]; roomDetails: { [key: string]: RoomDetail } }>();
|
||||
@@ -46,7 +47,8 @@ function buildCsvByRoom(): string {
|
||||
const headers = [
|
||||
'roomId', 'variant', 'round', 'status',
|
||||
'p1_uuid', 'p1_name', 'p1_pavo', 'p1_elote', 'p1_shame',
|
||||
'p2_uuid', 'p2_name', 'p2_pavo', 'p2_elote', 'p2_shame'
|
||||
'p2_uuid', 'p2_name', 'p2_pavo', 'p2_elote', 'p2_shame',
|
||||
'events_history'
|
||||
];
|
||||
const lines: string[] = [headers.join(',')];
|
||||
|
||||
@@ -59,6 +61,9 @@ function buildCsvByRoom(): string {
|
||||
const p1 = players.find(p => p.role === 'P1') || players[0] || ({} as any);
|
||||
const p2 = players.find(p => p.role === 'P2') || players[1] || ({} as any);
|
||||
|
||||
const kinds = ((det.systemMessages || []) as Array<{ kind: string }>).map(m => (m?.kind || '').toString()).filter(Boolean);
|
||||
const eventsHistory = kinds.join('|');
|
||||
|
||||
const row = [
|
||||
room.roomId,
|
||||
variant,
|
||||
@@ -73,7 +78,8 @@ function buildCsvByRoom(): string {
|
||||
p2?.name || '',
|
||||
p2?.pavoTokens ?? 0,
|
||||
p2?.eloteTokens ?? 0,
|
||||
p2?.shameTokens ?? 0
|
||||
p2?.shameTokens ?? 0,
|
||||
eventsHistory
|
||||
].map(csvEscape).join(',');
|
||||
lines.push(row);
|
||||
});
|
||||
@@ -114,6 +120,7 @@ function buildCsvByUuid(): string {
|
||||
return lines.join('\n') + '\n';
|
||||
}
|
||||
|
||||
|
||||
function triggerDownload(csv: string, suffix: string) {
|
||||
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
Reference in New Issue
Block a user