Fixes terminated hunt issues

This commit is contained in:
2026-05-18 23:35:12 -05:00
parent 46060fc150
commit efab8b3083
3 changed files with 3 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ export interface HuntResponse {
startDateTime: string startDateTime: string
endDateTime: string endDateTime: string
isTerminated: boolean isTerminated: boolean
terminated?: boolean // Spring may serialize boolean getter isTerminated() as "terminated"
} }
export interface TeamResponse { export interface TeamResponse {

View File

@@ -7,7 +7,7 @@ export function parseUTC(iso: string): Date {
} }
export function huntStatus(hunt: HuntResponse): 'ONGOING' | 'UNSTARTED' | 'CLOSED' { export function huntStatus(hunt: HuntResponse): 'ONGOING' | 'UNSTARTED' | 'CLOSED' {
if (hunt.isTerminated) return 'CLOSED' if (hunt.isTerminated || hunt.terminated) return 'CLOSED'
const now = Date.now() const now = Date.now()
if (now < parseUTC(hunt.startDateTime).getTime()) return 'UNSTARTED' if (now < parseUTC(hunt.startDateTime).getTime()) return 'UNSTARTED'
if (now > parseUTC(hunt.endDateTime).getTime()) return 'CLOSED' if (now > parseUTC(hunt.endDateTime).getTime()) return 'CLOSED'

View File

@@ -49,7 +49,7 @@
editTitle = hunt.title editTitle = hunt.title
editStart = hunt.startDateTime editStart = hunt.startDateTime
editEnd = hunt.endDateTime editEnd = hunt.endDateTime
editTerminated = hunt.isTerminated editTerminated = hunt.isTerminated || hunt.terminated || false
editingHunt = true editingHunt = true
} }