mirror of
https://github.com/System-End/scraps.git
synced 2026-04-19 18:35:20 +00:00
parent
7e65d9eee8
commit
83bf93616f
3 changed files with 1 additions and 67 deletions
|
|
@ -491,30 +491,6 @@ projects.get("/:id", async ({ params, headers }) => {
|
||||||
hasSubmittedFeedback = feedbackCheck.length > 0;
|
hasSubmittedFeedback = feedbackCheck.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if project can be resubmitted (first submission must be on or before March 17th, 2026)
|
|
||||||
let canResubmit = true;
|
|
||||||
if (isOwner) {
|
|
||||||
const firstSubmission = await db
|
|
||||||
.select({ createdAt: projectActivityTable.createdAt })
|
|
||||||
.from(projectActivityTable)
|
|
||||||
.where(
|
|
||||||
and(
|
|
||||||
eq(projectActivityTable.projectId, parseInt(params.id)),
|
|
||||||
eq(projectActivityTable.action, "project_submitted"),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.orderBy(projectActivityTable.createdAt)
|
|
||||||
.limit(1);
|
|
||||||
|
|
||||||
if (firstSubmission.length > 0) {
|
|
||||||
const cutoffDate = new Date("2026-03-18T00:00:00Z");
|
|
||||||
canResubmit = firstSubmission[0].createdAt < cutoffDate;
|
|
||||||
} else {
|
|
||||||
// Never submitted before - cannot submit new projects
|
|
||||||
canResubmit = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate effective hours (subtract overlapping shipped project hours)
|
// Calculate effective hours (subtract overlapping shipped project hours)
|
||||||
// Uses activity-derived shipped dates for ordering (consistent with Airtable sync and admin review)
|
// Uses activity-derived shipped dates for ordering (consistent with Airtable sync and admin review)
|
||||||
const projectHours = project[0].hoursOverride ?? project[0].hours ?? 0;
|
const projectHours = project[0].hoursOverride ?? project[0].hours ?? 0;
|
||||||
|
|
@ -557,7 +533,6 @@ projects.get("/:id", async ({ params, headers }) => {
|
||||||
owner: projectOwner[0] || null,
|
owner: projectOwner[0] || null,
|
||||||
isOwner,
|
isOwner,
|
||||||
hasSubmittedFeedback: isOwner ? hasSubmittedFeedback : undefined,
|
hasSubmittedFeedback: isOwner ? hasSubmittedFeedback : undefined,
|
||||||
canResubmit: isOwner ? canResubmit : undefined,
|
|
||||||
activity,
|
activity,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
@ -865,27 +840,6 @@ projects.post("/:id/submit", async ({ params, headers, body }) => {
|
||||||
return { error: "Project cannot be submitted in current status" };
|
return { error: "Project cannot be submitted in current status" };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this is a resubmission - if so, verify first submission was on or before March 17th
|
|
||||||
const firstSubmission = await db
|
|
||||||
.select({ createdAt: projectActivityTable.createdAt })
|
|
||||||
.from(projectActivityTable)
|
|
||||||
.where(
|
|
||||||
and(
|
|
||||||
eq(projectActivityTable.projectId, parseInt(params.id)),
|
|
||||||
eq(projectActivityTable.action, "project_submitted"),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.orderBy(projectActivityTable.createdAt)
|
|
||||||
.limit(1);
|
|
||||||
|
|
||||||
if (firstSubmission.length > 0) {
|
|
||||||
// This is a resubmission - check if first submission was on or before March 17th, 2026
|
|
||||||
const cutoffDate = new Date("2026-03-18T00:00:00Z"); // Midnight March 18th = end of March 17th
|
|
||||||
if (firstSubmission[0].createdAt >= cutoffDate) {
|
|
||||||
return { error: "Resubmissions are only allowed for projects first submitted on or before March 17th" };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sync hours from Hackatime before submitting
|
// Sync hours from Hackatime before submitting
|
||||||
if (project[0].hackatimeProject) {
|
if (project[0].hackatimeProject) {
|
||||||
await syncSingleProject(parseInt(params.id));
|
await syncSingleProject(parseInt(params.id));
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@
|
||||||
let owner = $state<Owner | null>(null);
|
let owner = $state<Owner | null>(null);
|
||||||
let isOwner = $state(false);
|
let isOwner = $state(false);
|
||||||
let isAdmin = $state(false);
|
let isAdmin = $state(false);
|
||||||
let canResubmit = $state(true);
|
|
||||||
let activity = $state<ActivityEntry[]>([]);
|
let activity = $state<ActivityEntry[]>([]);
|
||||||
let loading = $state(true);
|
let loading = $state(true);
|
||||||
let error = $state<string | null>(null);
|
let error = $state<string | null>(null);
|
||||||
|
|
@ -105,7 +104,6 @@
|
||||||
project = result.project;
|
project = result.project;
|
||||||
owner = result.owner;
|
owner = result.owner;
|
||||||
isOwner = result.isOwner;
|
isOwner = result.isOwner;
|
||||||
canResubmit = result.canResubmit ?? true;
|
|
||||||
activity = result.activity || [];
|
activity = result.activity || [];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e instanceof Error ? e.message : 'Failed to load project';
|
error = e instanceof Error ? e.message : 'Failed to load project';
|
||||||
|
|
@ -456,7 +454,7 @@
|
||||||
<Send size={18} />
|
<Send size={18} />
|
||||||
{$t.project.awaitingReview}
|
{$t.project.awaitingReview}
|
||||||
</span>
|
</span>
|
||||||
{:else if project.status === 'shipped' && canResubmit}
|
{:else if project.status === 'shipped'}
|
||||||
<a
|
<a
|
||||||
href="/projects/{project.id}/submit"
|
href="/projects/{project.id}/submit"
|
||||||
class="flex flex-1 cursor-pointer items-center justify-center gap-2 rounded-full border-4 border-black bg-black px-4 py-3 text-sm font-bold text-white transition-all duration-200 hover:bg-gray-800 sm:px-6 sm:text-base"
|
class="flex flex-1 cursor-pointer items-center justify-center gap-2 rounded-full border-4 border-black bg-black px-4 py-3 text-sm font-bold text-white transition-all duration-200 hover:bg-gray-800 sm:px-6 sm:text-base"
|
||||||
|
|
@ -464,13 +462,6 @@
|
||||||
<RefreshCw size={18} />
|
<RefreshCw size={18} />
|
||||||
ship update
|
ship update
|
||||||
</a>
|
</a>
|
||||||
{:else if project.status === 'shipped' && !canResubmit}
|
|
||||||
<span
|
|
||||||
class="flex flex-1 cursor-not-allowed items-center justify-center gap-2 rounded-full border-4 border-black bg-gray-200 px-4 py-3 text-center text-sm font-bold text-gray-600 sm:px-6 sm:text-base"
|
|
||||||
>
|
|
||||||
<CheckCircle size={18} />
|
|
||||||
shipped
|
|
||||||
</span>
|
|
||||||
{:else if project.status === 'permanently_rejected'}
|
{:else if project.status === 'permanently_rejected'}
|
||||||
<span
|
<span
|
||||||
class="flex flex-1 cursor-not-allowed items-center justify-center gap-2 rounded-full border-4 border-black bg-red-100 px-4 py-3 text-center text-sm font-bold text-red-600 sm:px-6 sm:text-base"
|
class="flex flex-1 cursor-not-allowed items-center justify-center gap-2 rounded-full border-4 border-black bg-red-100 px-4 py-3 text-center text-sm font-bold text-red-600 sm:px-6 sm:text-base"
|
||||||
|
|
@ -478,13 +469,6 @@
|
||||||
<XCircle size={18} />
|
<XCircle size={18} />
|
||||||
{$t.project.permanentlyRejected}
|
{$t.project.permanentlyRejected}
|
||||||
</span>
|
</span>
|
||||||
{:else if !canResubmit}
|
|
||||||
<span
|
|
||||||
class="flex flex-1 cursor-not-allowed items-center justify-center gap-2 rounded-full border-4 border-black bg-gray-200 px-4 py-3 text-center text-sm font-bold text-gray-600 sm:px-6 sm:text-base"
|
|
||||||
>
|
|
||||||
<XCircle size={18} />
|
|
||||||
submissions closed
|
|
||||||
</span>
|
|
||||||
{:else if $tutorialActiveStore}
|
{:else if $tutorialActiveStore}
|
||||||
<span
|
<span
|
||||||
data-tutorial="submit-button"
|
data-tutorial="submit-button"
|
||||||
|
|
|
||||||
|
|
@ -128,10 +128,6 @@
|
||||||
if (!responseData.isOwner) {
|
if (!responseData.isOwner) {
|
||||||
throw new Error('You can only submit your own projects');
|
throw new Error('You can only submit your own projects');
|
||||||
}
|
}
|
||||||
// Check if resubmission is allowed
|
|
||||||
if (responseData.canResubmit === false) {
|
|
||||||
throw new Error('Resubmissions are only allowed for projects first submitted on or before March 17th');
|
|
||||||
}
|
|
||||||
project = responseData.project;
|
project = responseData.project;
|
||||||
imagePreview = project?.image || null;
|
imagePreview = project?.image || null;
|
||||||
hasSubmittedFeedbackBefore = responseData.hasSubmittedFeedback ?? false;
|
hasSubmittedFeedbackBefore = responseData.hasSubmittedFeedback ?? false;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue