diff --git a/backend/dist/index.js b/backend/dist/index.js index e03ba7f..7ba2252 100644 --- a/backend/dist/index.js +++ b/backend/dist/index.js @@ -34330,6 +34330,7 @@ async function fetchOtherYswsHours(codeUrls, playableUrls) { return urlHoursMap; } const baseUrl = `https://api.airtable.com/v0/${config.unifiedAirtableBaseId}/${config.unifiedAirtableTableId}`; + const seenRecordIds = new Set; async function fetchByFormula(formula) { const results = []; let offset; @@ -34352,11 +34353,15 @@ async function fetchOtherYswsHours(codeUrls, playableUrls) { break; const data = await res.json(); for (const record of data.records) { + if (seenRecordIds.has(record.id)) + continue; + seenRecordIds.add(record.id); const overrideHours = record.fields["Override Hours Spent"]; const hoursSpent = record.fields["Hours Spent"]; const hours = Number(overrideHours ?? hoursSpent ?? 0); if (hours > 0) { results.push({ + recordId: record.id, codeUrl: record.fields["Code URL"] || "", playableUrl: record.fields["Playable URL"] || "", hours diff --git a/backend/src/lib/airtable-sync.ts b/backend/src/lib/airtable-sync.ts index 1477209..e55037f 100644 --- a/backend/src/lib/airtable-sync.ts +++ b/backend/src/lib/airtable-sync.ts @@ -25,8 +25,10 @@ export async function fetchOtherYswsHours(codeUrls: Set, playableUrls: S const baseUrl = `https://api.airtable.com/v0/${config.unifiedAirtableBaseId}/${config.unifiedAirtableTableId}` - async function fetchByFormula(formula: string): Promise<{ codeUrl: string; playableUrl: string; hours: number }[]> { - const results: { codeUrl: string; playableUrl: string; hours: number }[] = [] + const seenRecordIds = new Set() + + async function fetchByFormula(formula: string): Promise<{ recordId: string; codeUrl: string; playableUrl: string; hours: number }[]> { + const results: { recordId: string; codeUrl: string; playableUrl: string; hours: number }[] = [] let offset: string | undefined do { const params = new URLSearchParams({ @@ -47,11 +49,14 @@ export async function fetchOtherYswsHours(codeUrls: Set, playableUrls: S const data = await res.json() as { records: { id: string; fields: Record }[]; offset?: string } for (const record of data.records) { + if (seenRecordIds.has(record.id)) continue + seenRecordIds.add(record.id) const overrideHours = record.fields['Override Hours Spent'] const hoursSpent = record.fields['Hours Spent'] const hours = Number(overrideHours ?? hoursSpent ?? 0) if (hours > 0) { results.push({ + recordId: record.id, codeUrl: record.fields['Code URL'] || '', playableUrl: record.fields['Playable URL'] || '', hours,