diff --git a/src/referto.js b/src/referto.js
index 0c636c8..c2a59cf 100644
--- a/src/referto.js
+++ b/src/referto.js
@@ -87,17 +87,31 @@ export function buildRefertoHtml(state, now = new Date()) {
return `
- `
}).join('')
+ const risultatoSetHtml = setReali.map((s, i) => {
+ let h = 0, g = 0
+ for (const c of s.ris) c === 'h' ? h++ : g++
+ const vinc = vincitoreSet(s)
+ return `
+ | ${i + 1} |
+ ${h} |
+ ${g} |
+
`
+ }).join('')
+
const html = `
@@ -105,55 +119,93 @@ export function buildRefertoHtml(state, now = new Date()) {
Referto — ${nomi.home} vs ${nomi.guest}
-
+
+
-
-
${nomi.home}
-
vs
-
${nomi.guest}
-
-
${setVinti.home} – ${setVinti.guest}
-
set vinti
+ ${setsHtml}
- ${setsHtml}
+
+
+
+
+ | Set | A | B |
+ ${risultatoSetHtml}
+
+
Vince ${setVinti.home >= setVinti.guest ? nomi.home : nomi.guest} ${setVinti.home} – ${setVinti.guest}
+
+
+
${setVinti.home} – ${setVinti.guest}
+
set vinti
+
+
+
`
diff --git a/tests/e2e/referto.spec.cjs b/tests/e2e/referto.spec.cjs
index c4da05d..e16cb2a 100644
--- a/tests/e2e/referto.spec.cjs
+++ b/tests/e2e/referto.spec.cjs
@@ -40,8 +40,7 @@ test.describe('Referto di fine partita', () => {
// Verifica il contenuto del referto
const body = popup.locator('body');
await expect(body).toContainText('Referto di Gara');
- await expect(body).toContainText('Set 1');
- await expect(body).toContainText('Set 2');
+ await expect(popup.locator('.set-numero')).toHaveText(['1', '2']);
// Home ha vinto 2 set a 0
await expect(body).toContainText('2 – 0');
});
diff --git a/tests/unit/referto.test.js b/tests/unit/referto.test.js
index 5cd8e58..96e6524 100644
--- a/tests/unit/referto.test.js
+++ b/tests/unit/referto.test.js
@@ -21,10 +21,10 @@ describe('buildRefertoHtml (referto.js)', () => {
{ serv: 'h', ris: 'h'.repeat(25) + 'g'.repeat(18), vinc: 'h' },
]
const html = buildRefertoHtml(statoConSet(striscia), NOW)
- // due set reali → "Set 1" e "Set 2", mai "Set 3"
- expect(html).toContain('Set 1')
- expect(html).toContain('Set 2')
- expect(html).not.toContain('Set 3')
+ // due set reali → numeri "1" e "2" nella barra SET, mai "3"
+ expect(html).toContain('
1')
+ expect(html).toContain('
2')
+ expect(html).not.toContain('
3')
})
it('calcola il punteggio finale di ogni set dalla ris', () => {