Skip to content

Commit

Permalink
messed up the order of submissions
Browse files Browse the repository at this point in the history
  • Loading branch information
FallBackITA27 committed Apr 11, 2024
1 parent 9890cf7 commit 36b1e15
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions mkwpp-parser/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,14 @@ document.getElementById("readInput").addEventListener("click", async function()
for (let line of parserData) {
let keywords = line.toLowerCase().split(" ").filter(r=>r !== "");
console.log(keywords);
if (keywords[0].startsWith("name")) {
if (keywords[0].startsWith("date")) {
skipToNextSubmission = false
data.submissions.push(currentSubmission);
currentSubmission = {
name: keywords.slice(1,keywords.length).join(" "),
date: "",
flapCatch: false,
noscCatch: false,
};
console.log(currentSubmission);
} else if (keywords[0].startsWith("date")) {
let year;
let month;
let date;
if (keywords.length > 4) {
skipToNextSubmission = true;
currentSubmission.skip = true;
currentSubmission.err = true;
currentSubmission.errString = "Cannot parse date";
};
Expand All @@ -81,7 +72,14 @@ document.getElementById("readInput").addEventListener("click", async function()
let kwfiltered = kw.replace(/nth/g, "").replace(/rd/g, "").replace(/nd/g, "").replace(/st/g, "");
date = kwfiltered.padStart(2,"0")
};
currentSubmission.date = `${year}-${month}-${date}`;
currentSubmission = {
name: "",
date: `${year}-${month}-${date}`,
flapCatch: false,
noscCatch: false,
};
} else if (keywords[0].startsWith("name")) {
currentSubmission.name = keywords.slice(1,keywords.length).join(" ");
}

if (skipToNextSubmission) continue;
Expand Down

0 comments on commit 36b1e15

Please sign in to comment.