AI Implementation feature(907): Challenges Page and Challenge Solve Modal 1.03 (#49)
This commit was merged in pull request #49.
This commit is contained in:
@@ -18,13 +18,14 @@ export interface EventSourceLike {
|
||||
}
|
||||
|
||||
export function formatDdHhMm(totalSeconds: number): string {
|
||||
if (!Number.isFinite(totalSeconds) || totalSeconds < 0) return '00:00:00';
|
||||
if (!Number.isFinite(totalSeconds) || totalSeconds < 0) return '00:00:00:00';
|
||||
const s = Math.floor(totalSeconds);
|
||||
const days = Math.floor(s / 86400);
|
||||
const hours = Math.floor((s % 86400) / 3600);
|
||||
const minutes = Math.floor((s % 3600) / 60);
|
||||
const seconds = s % 60;
|
||||
const pad = (n: number) => n.toString().padStart(2, '0');
|
||||
return `${pad(days)}:${pad(hours)}:${pad(minutes)}`;
|
||||
return `${pad(days)}:${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
|
||||
}
|
||||
|
||||
export function deriveCountdownText(
|
||||
@@ -35,9 +36,9 @@ export function deriveCountdownText(
|
||||
if (state === 'unconfigured') return '';
|
||||
if (state === 'stopped') return 'Event ended';
|
||||
if (state === 'countdown') {
|
||||
return secondsToStart == null ? '00:00:00' : formatDdHhMm(secondsToStart);
|
||||
return secondsToStart == null ? '00:00:00:00' : formatDdHhMm(secondsToStart);
|
||||
}
|
||||
return secondsToEnd == null ? '00:00:00' : formatDdHhMm(secondsToEnd);
|
||||
return secondsToEnd == null ? '00:00:00:00' : formatDdHhMm(secondsToEnd);
|
||||
}
|
||||
|
||||
export const LED_COLOR_BY_STATE: Readonly<Record<EventState, string>> = {
|
||||
|
||||
@@ -120,13 +120,14 @@ export function sortColumnsByAbbrev(columns: readonly CategoryColumn[]): Categor
|
||||
}
|
||||
|
||||
export function formatDdHhMm(totalSeconds: number): string {
|
||||
if (!Number.isFinite(totalSeconds) || totalSeconds < 0) return '00:00:00';
|
||||
if (!Number.isFinite(totalSeconds) || totalSeconds < 0) return '00:00:00:00';
|
||||
const s = Math.floor(totalSeconds);
|
||||
const days = Math.floor(s / 86400);
|
||||
const hours = Math.floor((s % 86400) / 3600);
|
||||
const minutes = Math.floor((s % 3600) / 60);
|
||||
const seconds = s % 60;
|
||||
const pad = (n: number) => n.toString().padStart(2, '0');
|
||||
return `${pad(days)}:${pad(hours)}:${pad(minutes)}`;
|
||||
return `${pad(days)}:${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
|
||||
}
|
||||
|
||||
export function formatUtcToLocal(utc: string | null | undefined): string {
|
||||
|
||||
@@ -43,6 +43,7 @@ export class ChallengesApiService {
|
||||
return this.http
|
||||
.get<ChallengeDetail>(`/api/v1/challenges/${encodeURIComponent(challengeId)}`, {
|
||||
withCredentials: true,
|
||||
params: { include: 'solvers' },
|
||||
})
|
||||
.pipe(catchError((err) => throwError(() => toEnvelope(err))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user