Tweak Splatfest updater to handle new paginated query

This commit is contained in:
Matt Isenhower 2024-09-05 08:01:12 -07:00
parent 9d59b03476
commit 2736996f05
2 changed files with 16 additions and 3 deletions

View File

@ -59,7 +59,20 @@ export default class FestivalUpdater extends DataUpdater
}
async getData(locale) {
let result = await this.splatnet(locale).getFestRecordData();
let cursor = null;
let hasNextPage = true;
let result = { data: { festRecords: { nodes: [] } } };
while (hasNextPage) {
let data = await this.splatnet(locale).getFestRecordDataPage(cursor);
// Grab the nodes from the current page
result.data.festRecords.nodes.push(...jsonpath.query(data, '$..festRecords.edges.*.node'));
// Update the cursor and next page indicator
cursor = data.data.festRecords.pageInfo.endCursor;
hasNextPage = data.data.festRecords.pageInfo.hasNextPage;
}
this.deriveFestivalIds(result);

View File

@ -156,8 +156,8 @@ export default class SplatNet3Client
return this.getGraphQLPersistedQuery(1, 'CoopHistoryQuery');
}
getFestRecordData() {
return this.getGraphQLPersistedQuery(1, 'FestRecordQuery');
getFestRecordDataPage(cursor = null) {
return this.getGraphQLPersistedQuery(1, 'FestRecordPaginationQuery', { cursor, first: 100 });
}
getFestDetailData(festId) {