fix(indicadores): decir intervalo de tiempo en lugar de granularidad
El filtro general y sus mensajes de compatibilidad nombran «Intervalo de tiempo» (semestre o mes) en lugar de «Granularidad», que no es un término clínico. Cambian la etiqueta del selector y los cinco mensajes que la mencionan; las pruebas que citaban esos textos se ajustan. CSO5.5
This commit is contained in:
@@ -292,9 +292,9 @@ describe('IndicadorFigureCard', () => {
|
||||
state({ status: 'loading' });
|
||||
expect(firstHost.closest('[hidden]')).toBeTruthy();
|
||||
expect(purge).not.toHaveBeenCalled(); expect(disconnect).not.toHaveBeenCalled();
|
||||
state({ status: 'incompatible', message: 'Granularidad no publicada' });
|
||||
state({ status: 'incompatible', message: 'Intervalo de tiempo no publicado' });
|
||||
expect(firstHost.closest('[hidden]')).toBeTruthy();
|
||||
expect(fixture.nativeElement.querySelector('.incompatible').textContent).toContain('Granularidad no publicada');
|
||||
expect(fixture.nativeElement.querySelector('.incompatible').textContent).toContain('Intervalo de tiempo no publicado');
|
||||
ready({ data: [{ y: [50] }], layout: {} }); await settle();
|
||||
expect(fixture.nativeElement.querySelector('.plot')).toBe(firstHost);
|
||||
expect(firstHost.closest('[hidden]')).toBeNull();
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('KPI búsqueda inicial del último dato visible', () => {
|
||||
categorias: kind === 'incomplete' ? { A: {}, B: {} } : { A: {} },
|
||||
filas: [{ periodo: period, grupo: 'TOTAL', categoria: 'A', n: kind === 'null' ? null : value, suprimido: kind === 'suppressed' ? 1 : 0 }] };
|
||||
}
|
||||
it('consulta secuencialmente por granularidad, detiene al visible y explica supresión posterior', () => {
|
||||
it('consulta secuencialmente por intervalo de tiempo, detiene al visible y explica supresión posterior', () => {
|
||||
const latest = request(periods[0]); http.expectNone(() => true);
|
||||
expect(fixture.componentInstance.result().loading).toBe(true);
|
||||
latest.flush(data(periods[0], 'suppressed'));
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<section aria-label="Editor de filtros generales del proyecto">
|
||||
@if (state.tipo === 'mes') { <p class="filter-help">Para consultar meses debes elegir periodos explícitos. Todos con reporte utiliza semestres.</p> }
|
||||
@if (!types.includes(state.tipo)) { <p role="status">La granularidad del borrador ya no está publicada para este proyecto. Elige una granularidad disponible.</p> }
|
||||
@if (!types.includes(state.tipo)) { <p role="status">El intervalo de tiempo del borrador ya no está publicado para este proyecto. Elige un intervalo de tiempo disponible.</p> }
|
||||
<div class="fields">
|
||||
@if (types.length > 1 || !types.includes(state.tipo)) {
|
||||
<mat-form-field appearance="outline" subscriptSizing="dynamic"><mat-label>Granularidad</mat-label>
|
||||
<mat-form-field appearance="outline" subscriptSizing="dynamic"><mat-label>Intervalo de tiempo</mat-label>
|
||||
<mat-select [ngModel]="state.tipo" (ngModelChange)="changeTipo($event)">
|
||||
@for (tipo of types; track tipo) { <mat-option [value]="tipo">{{ tipo === 'mes' ? 'Mes' : 'Semestre' }}</mat-option> }
|
||||
</mat-select>
|
||||
@@ -36,7 +36,7 @@
|
||||
@else if (availability.status === 'error') {
|
||||
<p role="alert">No se pudo completar la consulta de periodos disponibles.</p>
|
||||
<button type="button" mat-stroked-button (click)="retryAvailability.emit()">Reintentar disponibilidad</button>
|
||||
} @else if (!options.length) { <p role="status">Sin reportes disponibles para esta granularidad.</p> }
|
||||
} @else if (!options.length) { <p role="status">Sin reportes disponibles para este intervalo de tiempo.</p> }
|
||||
@if (entry.draft.mode === 'explicit' && unavailableSelection.length) { <p role="status">La selección conservada contiene periodos cuya disponibilidad no está confirmada. Elige periodos disponibles antes de aplicar.</p> }
|
||||
}
|
||||
@if (!availability && entry.draft.mode !== 'todos') {
|
||||
|
||||
@@ -114,7 +114,7 @@ describe('D.2 integración de autoridad global y consumidores', () => {
|
||||
expect(panel.result().status).toBe('incompatible'); expect(panel.result().figure).toBeUndefined();
|
||||
http.expectNone(r => r.url.includes('/a/figuras/')); const r = request('b');
|
||||
expect(r.request.params.get('periodos')).toBe('2025-01'); expect(r.request.params.has('tipoPeriodo')).toBe(false);
|
||||
expect(fixture.nativeElement.querySelector('.incompatible').textContent).toContain('granularidad mes');
|
||||
expect(fixture.nativeElement.querySelector('.incompatible').textContent).toContain('intervalo de tiempo mes');
|
||||
expect((host as HTMLElement).parentElement!.hidden).toBe(true);
|
||||
r.flush({ data: [], layout: {} });
|
||||
expect(fixture.nativeElement.textContent).not.toContain('Todos los meses');
|
||||
|
||||
@@ -74,7 +74,7 @@ describe.each(['cacu', 'cama'] as const)('P0 búsqueda del ancla C2 de %s', doma
|
||||
const run = start(); http.expectOne(`/${domain}/indicadores/${anchor.id}/periodos`).flush('', { status: 404, statusText: 'Missing' });
|
||||
expect(run.failed()).toBe(true); expect(run.completed()).toBe(false); http.expectNone(() => true);
|
||||
});
|
||||
it.each(['semestre', 'mes'] as const)('busca únicamente la granularidad activa %s, sin mezclar tipos ni usar un mes más reciente', tipo => {
|
||||
it.each(['semestre', 'mes'] as const)('busca únicamente el intervalo de tiempo activo %s, sin mezclar tipos ni usar un mes más reciente', tipo => {
|
||||
const run = start(tipo); inventory(['2026-12', '2025-10', '2026-S1', '2025-S2']);
|
||||
const expected = tipo === 'mes' ? '2026-12' : '2026-S1'; request(expected).flush(data(expected));
|
||||
expect(run.selected()).toEqual({ periodo: expected, tipo }); http.expectNone(() => true);
|
||||
|
||||
@@ -68,7 +68,7 @@ describe('D.2 memoria global por dominio', () => {
|
||||
it.each([{ types: [] }, { types: ['semestre'] }, { types: ['mes', 'semestre'] }] as { types: TipoPeriodo[] }[])('adapter explica incompatibilidad mensual Todos con %j', ({ types }) => {
|
||||
expect(filterCompatibility({ tipo: 'mes', selection: { mode: 'todos' }, revision: 1 }, types).compatible).toBe(false);
|
||||
});
|
||||
it('adapter no transforma ni recorta y requiere primera granularidad para Todos', () => {
|
||||
it('adapter no transforma ni recorta y requiere el primer intervalo de tiempo para Todos', () => {
|
||||
const applied: GlobalFilterState['applied'] = { tipo: 'mes', selection: { mode: 'explicit', periodos: ['2025-01', '2025-02'] }, revision: 1 };
|
||||
const snapshot = JSON.stringify(applied);
|
||||
expect(filterCompatibility(applied, ['semestre', 'mes']).compatible).toBe(true);
|
||||
|
||||
@@ -46,11 +46,11 @@ export type Compatibility = { compatible: true } | { compatible: false; reason:
|
||||
export function filterCompatibility(applied: GlobalApplied | undefined, types: readonly TipoPeriodo[]): Compatibility {
|
||||
if (!types.length) return { compatible: false, reason: 'El catálogo no declara capacidades temporales suficientes para consultar.' };
|
||||
if (!applied) return { compatible: false, reason: 'No hay un filtro general aplicado.' };
|
||||
if (!types.includes(applied.tipo)) return { compatible: false, reason: 'Esta figura no admite la granularidad ' + applied.tipo + ' del filtro general.' };
|
||||
if (!types.includes(applied.tipo)) return { compatible: false, reason: 'Esta figura no admite el intervalo de tiempo ' + applied.tipo + ' del filtro general.' };
|
||||
const mode = applied.selection.mode;
|
||||
if (!validDraft(applied.selection, applied.tipo, [...types])) return { compatible: false, reason: mode === 'todos'
|
||||
? 'Todos con reporte requiere semestre como primera granularidad publicada. Para meses elige periodos explícitos.'
|
||||
: 'Los periodos del filtro general no son válidos para esta granularidad.' };
|
||||
? 'Todos con reporte requiere semestre como primer intervalo de tiempo publicado. Para meses elige periodos explícitos.'
|
||||
: 'Los periodos del filtro general no son válidos para este intervalo de tiempo.' };
|
||||
return { compatible: true };
|
||||
}
|
||||
export function applyGlobal(state: GlobalFilterState, types: TipoPeriodo[]): boolean {
|
||||
|
||||
@@ -142,7 +142,7 @@ describe('UX-04 validación defensiva HTTP', () => {
|
||||
|
||||
describe('contrato datos exclusivo de KPI', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({ providers: [provideHttpClient(), provideHttpClientTesting()] }));
|
||||
it('envía sólo periodos explícitos sin granularidad ni tema y conserva filas y notas', () => {
|
||||
it('envía sólo periodos explícitos sin intervalo de tiempo ni tema y conserva filas y notas', () => {
|
||||
const http = TestBed.inject(HttpTestingController); let result: unknown;
|
||||
TestBed.inject(IndicadoresService).datos('cacu', 'cacu_eu7', 'mes', ['2025-01']).subscribe(v => result = v);
|
||||
const req = http.expectOne(r => r.url === '/cacu/indicadores/cacu_eu7/datos');
|
||||
|
||||
Reference in New Issue
Block a user