diff --git a/backend/dist/index.js b/backend/dist/index.js index 7ba2252..9e1703a 100644 --- a/backend/dist/index.js +++ b/backend/dist/index.js @@ -34659,16 +34659,18 @@ async function syncProjectsToAirtable() { effectiveHours = Math.max(0, effectiveHours); } } - let otherYswsDeduction = 0; - if (project.githubUrl && otherYswsHours.has(project.githubUrl)) { - otherYswsDeduction += otherYswsHours.get(project.githubUrl); - } - if (project.playableUrl && otherYswsHours.has(project.playableUrl)) { - otherYswsDeduction += otherYswsHours.get(project.playableUrl); - } - if (otherYswsDeduction > 0) { - console.log(`[AIRTABLE-SYNC] Deducting ${otherYswsDeduction}h from project ${project.id} (awarded in other YSWS programs)`); - effectiveHours = Math.max(0, effectiveHours - otherYswsDeduction); + if (project.hoursOverride === null) { + let otherYswsDeduction = 0; + if (project.githubUrl && otherYswsHours.has(project.githubUrl)) { + otherYswsDeduction += otherYswsHours.get(project.githubUrl); + } + if (project.playableUrl && otherYswsHours.has(project.playableUrl)) { + otherYswsDeduction += otherYswsHours.get(project.playableUrl); + } + if (otherYswsDeduction > 0) { + console.log(`[AIRTABLE-SYNC] Deducting ${otherYswsDeduction}h from project ${project.id} (awarded in other YSWS programs)`); + effectiveHours = Math.max(0, effectiveHours - otherYswsDeduction); + } } const firstName = userIdentity?.first_name || (project.username || "").split(" ")[0] || ""; const lastName = userIdentity?.last_name || (project.username || "").split(" ").slice(1).join(" ") || ""; diff --git a/backend/src/lib/airtable-sync.ts b/backend/src/lib/airtable-sync.ts index e55037f..5b53aa3 100644 --- a/backend/src/lib/airtable-sync.ts +++ b/backend/src/lib/airtable-sync.ts @@ -444,16 +444,19 @@ export async function syncProjectsToAirtable(): Promise { } // Deduct hours already awarded in other YSWS programs - let otherYswsDeduction = 0 - if (project.githubUrl && otherYswsHours.has(project.githubUrl)) { - otherYswsDeduction += otherYswsHours.get(project.githubUrl)! - } - if (project.playableUrl && otherYswsHours.has(project.playableUrl)) { - otherYswsDeduction += otherYswsHours.get(project.playableUrl)! - } - if (otherYswsDeduction > 0) { - console.log(`[AIRTABLE-SYNC] Deducting ${otherYswsDeduction}h from project ${project.id} (awarded in other YSWS programs)`) - effectiveHours = Math.max(0, effectiveHours - otherYswsDeduction) + // Skip deduction if project has an override — the reviewer already set the intended hours + if (project.hoursOverride === null) { + let otherYswsDeduction = 0 + if (project.githubUrl && otherYswsHours.has(project.githubUrl)) { + otherYswsDeduction += otherYswsHours.get(project.githubUrl)! + } + if (project.playableUrl && otherYswsHours.has(project.playableUrl)) { + otherYswsDeduction += otherYswsHours.get(project.playableUrl)! + } + if (otherYswsDeduction > 0) { + console.log(`[AIRTABLE-SYNC] Deducting ${otherYswsDeduction}h from project ${project.id} (awarded in other YSWS programs)`) + effectiveHours = Math.max(0, effectiveHours - otherYswsDeduction) + } } const firstName = userIdentity?.first_name || (project.username || '').split(' ')[0] || ''