Fixes terminated hunt issues
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
@@ -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'
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user