mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-10-28 18:58:59 -04:00
fixed rest detail showing zeros without rest data
This commit is contained in:
1 parent
ba77792b59
commit
3df02257e2
2 files changed
+15
-2
No files matched your search
+10
@@ -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();
|
||||
|
||||
|
||||
+5
-2
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user