From f3b73f44043f0ba8686c83ad3bb26e5932aca0c6 Mon Sep 17 00:00:00 2001 From: angel Date: Sat, 21 Nov 2026 15:42:19 -0600 Subject: [PATCH] CaMa survival menu: a patient in no drawable scenario gets no default curve --- .../cama/cama-analisis-supervivencia.component.html | 4 +++- .../cama/cama-analisis.component.spec.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/app/features/indicadores/paciente-detalle/cama/cama-analisis-supervivencia.component.html b/src/app/features/indicadores/paciente-detalle/cama/cama-analisis-supervivencia.component.html index 08f6d46..6755601 100644 --- a/src/app/features/indicadores/paciente-detalle/cama/cama-analisis-supervivencia.component.html +++ b/src/app/features/indicadores/paciente-detalle/cama/cama-analisis-supervivencia.component.html @@ -7,10 +7,12 @@ @if (m.escenarios.length === 0) {

Todavía no hay escenarios clínicos con pacientes suficientes para mostrar.

} @else { + @if (escenario() === null) {

La paciente no pertenece a ningún escenario clínico con pacientes suficientes; elige uno para ver su curva.

} @let l = lectura(); @if (l?.tipo === 'cargando') {

Calculando con los datos más recientes…

} @if (l?.tipo === 'rechazada') {

{{ $any(l).motivo }}

} diff --git a/src/app/features/indicadores/paciente-detalle/cama/cama-analisis.component.spec.ts b/src/app/features/indicadores/paciente-detalle/cama/cama-analisis.component.spec.ts index e79a1bf..8582669 100644 --- a/src/app/features/indicadores/paciente-detalle/cama/cama-analisis.component.spec.ts +++ b/src/app/features/indicadores/paciente-detalle/cama/cama-analisis.component.spec.ts @@ -99,6 +99,18 @@ describe('Análisis de supervivencia', () => { expect([...(f.nativeElement as HTMLElement).querySelectorAll('h5')].map(h => h.textContent!.trim())).toEqual(['Análisis de supervivencia', 'Factores de riesgo']); }); + // Fails if a patient in no drawable scenario gets another subgroup's curve instead of a prompt to choose one. + it('draws nothing and asks to choose when the patient belongs to no scenario', () => { + TestBed.resetTestingModule(); + TestBed.configureTestingModule({ providers: [plotly(), { provide: CamaCurvasService, useValue: { + escenarios: () => of({ escenarios: [{ nombre: '< 45 años', n: 100 }], predeterminado: null }), consulta } }] }); + const f = montar(); + + expect(consulta).not.toHaveBeenCalled(); + expect(f.nativeElement.querySelectorAll('app-plotly-chart')).toHaveLength(0); + expect(texto(f)).toContain('no pertenece a ningún escenario clínico'); + }); + // Fails if choosing a scenario changes only the curve or only the label: the selector decides both at once, one scenario at a time. it('changes the curve and the label together when another scenario is chosen, and never draws two', () => { const f = montar();