Don't fetch voting status for a Splatfest after it ends

This commit is contained in:
Samuel Elliott
2022-09-26 16:00:11 +01:00
parent 85d93c681e
commit b71246719a

View File

@@ -160,9 +160,11 @@ export class SplatNet3User {
async getCurrentFestVotes(): Promise<DetailVotingStatusResult['fest'] | null> {
await this.update('fest_vote_status', async () => {
const schedules = await this.getSchedules();
this.fest_vote_status = !schedules.currentFest ? null : this.fest_vote_status ?
await this.splatnet.getFestVotingStatusRefetch(schedules.currentFest.id) :
await this.splatnet.getFestVotingStatus(schedules.currentFest.id);
this.fest_vote_status =
!schedules.currentFest || new Date(schedules.currentFest.endTime).getTime() <= Date.now() ? null :
this.fest_vote_status?.data.fest.id === schedules.currentFest.id ?
await this.splatnet.getFestVotingStatusRefetch(schedules.currentFest.id) :
await this.splatnet.getFestVotingStatus(schedules.currentFest.id);
}, this.update_interval_fest_voting_status ?? this.update_interval);
return this.fest_vote_status?.data.fest ?? null;