Skip to content

Commit

Permalink
preventing extra empty submission from being added and fixing bug whe…
Browse files Browse the repository at this point in the history
…re user could not re-edit a submission
  • Loading branch information
cxjohn committed Aug 31, 2023
1 parent 04e6f58 commit a6c4aa2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/components/submission/SubmissionStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,21 @@ export const useSubmissionStore = create<SubmissionStore>()((set, get) => ({
console.error(`ERROR -- rpc call getSubmission failed. submission_id: ${submission_id}`, data);
return;
}
let parsedLinks;
if ("links" in data && typeof data.links === "string") {
try {
parsedLinks = JSON.parse(data.links);
} catch (error) {
console.error("Failed to parse links:", error);
parsedLinks = [];
}
}

set({
submission: data,
submission: {
...data,
links: parsedLinks || [],
},
githubHandle: githubHandle,
fetching: false,
});
Expand Down
3 changes: 2 additions & 1 deletion src/server/routes/admin/importCSVData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const importCSVData = adminProcedure
createdEvaluationFields.push(evaluationField);
}

for (const row of parsedData) {
const validData = parsedData.filter((row: any) => row.project_name); //preventing empty rows from being added
for (const row of validData) {
const submissionId = uuid();
const submissionData = {
id: submissionId,
Expand Down

0 comments on commit a6c4aa2

Please sign in to comment.