Update SplatNet 3 types

This commit is contained in:
Samuel Elliott 2022-09-26 16:47:49 +01:00
parent 45c315978d
commit 19f9ba74ec
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
2 changed files with 8 additions and 6 deletions

View File

@ -258,6 +258,8 @@ function createApp(
if (fest_vote_status) {
for (const team of fest_vote_status.teams) {
if (!team.votes || !team.preVotes) continue;
for (const player of team.votes.nodes) {
if (player.userIcon.url !== friend.userIcon.url) continue;
@ -273,7 +275,7 @@ function createApp(
}
}
if (!match.splatoon3_fest_team) {
if (!match.splatoon3_fest_team && fest_vote_status.undecidedVotes) {
match.splatoon3_fest_team = null;
}
}
@ -366,7 +368,7 @@ function createApp(
for (const team of fest_vote_status.teams) {
const schedule_team = schedules.currentFest?.teams.find(t => t.id === team.id);
if (!schedule_team) continue; // Shouldn't ever happen
if (!schedule_team || !team.votes || !team.preVotes) continue; // Shouldn't ever happen
for (const player of team.votes.nodes) {
if (player.userIcon.url !== friend.userIcon.url) continue;
@ -385,7 +387,7 @@ function createApp(
}
}
if (!match_splatnet3_fest_team) {
if (!match_splatnet3_fest_team && fest_vote_status.undecidedVotes) {
match_splatnet3_fest_team = null;
}
}

View File

@ -137,13 +137,13 @@ export default class SplatNet3Monitor extends EmbeddedLoop {
// Identify the user by their icon as the vote list doesn't have friend IDs
let fest_team = this.cached_voting_status?.data.fest?.teams
.find(t => t.votes.nodes.find(f => f.userIcon.url === friend?.userIcon.url));
.find(t => t.votes?.nodes.find(f => f.userIcon.url === friend?.userIcon.url));
if (this.fest && friend && (!this.cached_voting_status || (friend?.vsMode?.mode === 'FEST' && !fest_team))) {
if (this.fest && friend && (!this.cached_voting_status || (friend.vsMode?.mode === 'FEST' && !fest_team))) {
this.cached_voting_status = await this.splatnet?.getFestVotingStatus(this.fest.id) ?? null;
fest_team = this.cached_voting_status?.data.fest?.teams
.find(t => t.votes.nodes.find(f => f.userIcon.url === friend?.userIcon.url));
.find(t => t.votes?.nodes.find(f => f.userIcon.url === friend?.userIcon.url));
}
this.fest_team_voting_status = fest_team ?? null;