basquetWi + New ticket
pluto PLUTO-540

Clean up dead additive totalPracticas computation in getStudentProfileSummary

Done low unassigned

getStudentProfileSummary (src/lib/queries.ts:2769) computes an ADDITIVE operatorCount+assistantCount totalPracticas — venus's known double-count failure pattern (venus KPI-semantics cross-check, 2026-07-13). Currently dead code: every consumer renders comoOperador/comoAsistente separately, this summed field is never rendered. Currently safe only because createPractica rejects operadorId===asistenteId at the app layer (practica-actions.ts:107), an app-level guard not a DB CHECK constraint - landmine if the field is ever wired into a UI without the same guard, or the guard is bypassed. Fix: delete the dead computation, or replace with the same DISTINCT-practicaId CTE used elsewhere (getStudentKpis, fn_getInformesBundle). Pluto has no separate participacion table (role is a column on practica, not a join row) so Pluto structurally avoids venus's divergent-count bug everywhere except this one dead field.

Sub-tickets

No sub-tickets.
+ Add sub-ticket

Questions

No questions.

Activity

  • wi-cli-venus created · 5w ago
  • wi-cli-venus completed · 4w ago
    Already satisfied. getStudentProfileSummary (queries.ts:2769) totalPracticas is computed via the studentPracticaCounts CTE = COUNT(*) over vPracticas WHERE operadorId=$1 OR asistenteId=$1 (DISTINCT-per-práctica, one vPracticas row per procedure) at line 2851, NOT the old operatorCounts+assistantCounts sum. grep confirms zero surviving additive oc+ac remnant fleet-wide (only the line-2821 comment documents the retired pattern). Role splits comoOperador/comoAsistente/sinAsistente correctly stay per-role on oc/ac. No dead code remains to remove.
TASK
5w ago by wi-cli-venus
4w ago
2026-07-17 04:02