Toglie la foto tessera dal profilo (DD-044)
Il Profilo non chiede più la foto tessera e la scheda admin non la mostra. Il completamento diventa dati personali 34%, documento 33%, certificato 33%. La migration m29 elimina la colonna profili_giocatore.foto_path; le 4 foto già caricate sono state cancellate dal bucket profili-giocatore. Migration applicata in produzione. Test: pesi e sezioni di profili-core, rendering di CampiProfilo, colonna rimossa sul database locale. Documentati DD-044, modulo profilo-giocatore, DATABASE, ROADMAP e changelog. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e822e4574b
commit
de78431090
21 files changed
+164
-79
No files matched your search
@@ -8,6 +8,7 @@ import {
|
||||
completamento,
|
||||
completamentoAllenatore,
|
||||
csvTesseramento,
|
||||
PESI,
|
||||
daRigaProfilo,
|
||||
formatDataBreve,
|
||||
giorniAllaScadenza,
|
||||
@@ -41,7 +42,6 @@ const vuoto: Profilo = {
|
||||
documentoRetroPath: null,
|
||||
certificatoScadenza: null,
|
||||
certificatoPath: null,
|
||||
fotoPath: null,
|
||||
};
|
||||
|
||||
const completo: Profilo = {
|
||||
@@ -60,18 +60,22 @@ const completo: Profilo = {
|
||||
documentoRetroPath: "g1/documento-retro.jpg",
|
||||
certificatoScadenza: "2027-06-30",
|
||||
certificatoPath: "g1/certificato.pdf",
|
||||
fotoPath: "g1/foto.jpg",
|
||||
};
|
||||
|
||||
// --- completamento -----------------------------------------------------------
|
||||
assert.equal(completamento(null), 0, "profilo inesistente = 0%");
|
||||
assert.equal(completamento(vuoto), 0);
|
||||
assert.equal(completamento(completo), 100, "tutte le sezioni piene = 100%");
|
||||
assert.equal(completamento({ ...completo, fotoPath: null }), 90, "la foto pesa 10");
|
||||
assert.equal(completamento({ ...completo, certificatoPath: null }), 70, "il certificato pesa 30");
|
||||
assert.equal(
|
||||
Object.values(PESI).reduce((somma, peso) => somma + peso, 0),
|
||||
100,
|
||||
"senza foto tessera (DD-044) i pesi di dati, documento e certificato fanno 100",
|
||||
);
|
||||
assert.deepEqual(Object.keys(sezioniComplete(completo)), ["dati", "documento", "certificato"]);
|
||||
assert.equal(completamento({ ...completo, certificatoPath: null }), 67, "il certificato pesa 33");
|
||||
assert.equal(
|
||||
completamento({ ...completo, email: null }),
|
||||
70,
|
||||
66,
|
||||
"i dati personali sono completi solo tutti insieme",
|
||||
);
|
||||
|
||||
@@ -216,7 +220,7 @@ assert.equal(
|
||||
email: "a@b.it",
|
||||
}),
|
||||
100,
|
||||
"bastano i quattro dati personali: niente indirizzo, documento, certificato, foto",
|
||||
"bastano i quattro dati personali: niente indirizzo, documento, certificato",
|
||||
);
|
||||
assert.equal(completamentoAllenatore({ ...vuoto, telefono: " " }), 0, "spazi soli non contano");
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ await assert.rejects(
|
||||
);
|
||||
|
||||
// --- file troppo grande: rifiutato anche con un formato valido ---------------
|
||||
const troppoGrande = new File([new Uint8Array(8 * 1024 * 1024 + 1)], "foto.jpg", {
|
||||
const troppoGrande = new File([new Uint8Array(8 * 1024 * 1024 + 1)], "certificato.jpg", {
|
||||
type: "image/jpeg",
|
||||
});
|
||||
await assert.rejects(
|
||||
() => caricaFile("g1", "foto", troppoGrande),
|
||||
() => caricaFile("g1", "certificato", troppoGrande),
|
||||
/File troppo grande: massimo 8 MB\./,
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/** Check dei campi del profilo: `bun test/unit/profilo-campi.test.ts` (DD-044: niente foto tessera). */
|
||||
import assert from "node:assert/strict";
|
||||
import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { CampiProfilo } from "@/components/crapp/ProfiloAmministrativo";
|
||||
import { profiloVuoto, sezioniComplete } from "@/lib/profili-core";
|
||||
|
||||
const corrente = profiloVuoto("g1");
|
||||
const html = renderToStaticMarkup(
|
||||
createElement(CampiProfilo, {
|
||||
corrente,
|
||||
aggiorna: () => {},
|
||||
sezioni: sezioniComplete(corrente),
|
||||
fileDocumento: createElement("p", null, "slot-documento"),
|
||||
fileCertificato: createElement("p", null, "slot-certificato"),
|
||||
}),
|
||||
);
|
||||
|
||||
// --- le sezioni rimaste ci sono ----------------------------------------------
|
||||
assert.ok(html.includes("Dati personali"));
|
||||
assert.ok(html.includes("slot-documento"), "lo slot del documento è mostrato");
|
||||
assert.ok(html.includes("slot-certificato"), "lo slot del certificato è mostrato");
|
||||
|
||||
// --- la foto tessera non c'è più, né come titolo né come campo ----------------
|
||||
assert.ok(!/foto tessera/i.test(html), "nessun riferimento alla foto tessera");
|
||||
assert.ok(!html.includes("fotoPath"));
|
||||
|
||||
console.log("profilo-campi: ok");
|
||||
Reference in new issue
Block a user