fix: rinomina score.nome in score.elemento per coerenza con tabella pesi
This commit is contained in:
@@ -74,7 +74,7 @@ CREATE TABLE IF NOT EXISTS score (
|
||||
client_code TEXT NOT NULL REFERENCES soggetti(client_code),
|
||||
sessione_id INTEGER NOT NULL REFERENCES sessioni(id),
|
||||
tipo TEXT NOT NULL CHECK (tipo IN ('asse','macro','fitness_age')),
|
||||
nome TEXT NOT NULL,
|
||||
elemento TEXT NOT NULL,
|
||||
valore REAL,
|
||||
copertura REAL NOT NULL,
|
||||
stato TEXT NOT NULL CHECK (stato IN ('ok','insufficiente')),
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('schema longevity', () => {
|
||||
db.prepare(`INSERT INTO soggetti (client_code, sesso) VALUES ('ISL-0001', 'F')`).run();
|
||||
db.prepare(`INSERT INTO sessioni (client_code, data, tipo) VALUES ('ISL-0001', '2026-08-21', 'checkup')`).run();
|
||||
db.prepare(
|
||||
`INSERT INTO score (client_code, sessione_id, tipo, nome, valore, copertura, stato, model_version)
|
||||
`INSERT INTO score (client_code, sessione_id, tipo, elemento, valore, copertura, stato, model_version)
|
||||
VALUES ('ISL-0001', 1, 'asse', 'Forza & Struttura', NULL, 0.2, 'insufficiente', 'v1.0')`
|
||||
).run();
|
||||
const row = db.prepare(`SELECT valore, stato FROM score`).get() as { valore: number | null; stato: string };
|
||||
@@ -49,12 +49,11 @@ describe('schema longevity', () => {
|
||||
expect(cols).toEqual(expect.arrayContaining(['client_code', 'user_id', 'nome', 'cognome', 'data_nascita']));
|
||||
|
||||
const lg = createLongevityDb(':memory:');
|
||||
// Esclude la tabella score (che ha una colonna nome legittima per il nome dello score calcolato).
|
||||
// Controlla che le colonne identificative della PERSONA non stiano nel longevity.
|
||||
const colonne = (lg.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name != 'score'`).all() as { name: string }[])
|
||||
const tutte = (lg.prepare(`SELECT name FROM sqlite_master WHERE type='table'`).all() as { name: string }[])
|
||||
.flatMap((t) => (lg.prepare(`PRAGMA table_info(${t.name})`).all() as { name: string }[]).map((c) => c.name));
|
||||
expect(colonne).not.toContain('cognome');
|
||||
expect(colonne).not.toContain('data_nascita');
|
||||
expect(tutte).not.toContain('nome');
|
||||
expect(tutte).not.toContain('cognome');
|
||||
expect(tutte).not.toContain('data_nascita');
|
||||
});
|
||||
|
||||
it('la soglia di copertura e 0.40', () => {
|
||||
|
||||
Reference in New Issue
Block a user