diff --git a/code/frontend/src/app/features/seeker-stats/searches-tab/seeker-preview-drawer/seeker-preview-drawer.component.spec.ts b/code/frontend/src/app/features/seeker-stats/searches-tab/seeker-preview-drawer/seeker-preview-drawer.component.spec.ts index ce02f37f..c7163fe4 100644 --- a/code/frontend/src/app/features/seeker-stats/searches-tab/seeker-preview-drawer/seeker-preview-drawer.component.spec.ts +++ b/code/frontend/src/app/features/seeker-stats/searches-tab/seeker-preview-drawer/seeker-preview-drawer.component.spec.ts @@ -138,6 +138,16 @@ describe('SeekerPreviewDrawerComponent', () => { ]); }); + it('renders no detail line for a resting exclusion without rest fields', () => { + const { fixture, host } = setup(of(preview({ + excluded: [{ name: 'Iota', reason: SeekerExclusionReason.Resting }], + }))); + + open(fixture, host); + + expect(texts('.preview__detail')).toEqual([]); + }); + it('requests the preview for the instance when opened', () => { const { fixture, host, getPreview } = setup(); diff --git a/code/frontend/src/app/features/seeker-stats/searches-tab/seeker-preview-drawer/seeker-preview-drawer.component.ts b/code/frontend/src/app/features/seeker-stats/searches-tab/seeker-preview-drawer/seeker-preview-drawer.component.ts index 650bd1be..c0e70fe7 100644 --- a/code/frontend/src/app/features/seeker-stats/searches-tab/seeker-preview-drawer/seeker-preview-drawer.component.ts +++ b/code/frontend/src/app/features/seeker-stats/searches-tab/seeker-preview-drawer/seeker-preview-drawer.component.ts @@ -116,9 +116,12 @@ export class SeekerPreviewDrawerComponent { if (item.reason !== SeekerExclusionReason.Resting) { return ''; } - const cycles = item.restCyclesLeft ?? 0; + if (item.restCyclesLeft == null || item.consecutiveMisses == null) { + return ''; + } + const cycles = item.restCyclesLeft; const until = item.restUntil ? ` or on ${formatDate(item.restUntil, 'MM/dd', this.locale)}` : ''; - return `${item.consecutiveMisses ?? 0} misses in a row · back after ${cycles} ${cycles === 1 ? 'cycle' : 'cycles'} end${until}`; + return `${item.consecutiveMisses} misses in a row · back after ${cycles} ${cycles === 1 ? 'cycle' : 'cycles'} end${until}`; } refresh(): void {