This commit is contained in:
NotARoomba 2026-03-12 17:03:02 -04:00
parent 8d2b90a482
commit 1c808047b4
2 changed files with 25 additions and 20 deletions

22
backend/dist/index.js vendored
View file

@ -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(" ") || "";

View file

@ -444,16 +444,19 @@ export async function syncProjectsToAirtable(): Promise<void> {
}
// 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] || ''