✨ Split substitution if it is longer than 1 lesson
This commit is contained in:
@ -24,7 +24,8 @@ export class Parser {
|
|||||||
succeeded: true,
|
succeeded: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const plan = JSON.parse(fs.readFileSync("tmpplans.json"));
|
const html = fs.readFileSync("plan.html");
|
||||||
|
const plan = parseSubstitutionPlan(html);
|
||||||
this.insertSubstitutions(plan, event);
|
this.insertSubstitutions(plan, event);
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
@ -136,6 +137,9 @@ export class Parser {
|
|||||||
"Insert / DB",
|
"Insert / DB",
|
||||||
`Created new substitution: S:${newSubstitution.id} C:${substitutionChange.id}`
|
`Created new substitution: S:${newSubstitution.id} C:${substitutionChange.id}`
|
||||||
);
|
);
|
||||||
|
// console.log("Oh no...", change);
|
||||||
|
} else {
|
||||||
|
console.log("ok");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,12 @@ export function parseSubstitutionPlan(html) {
|
|||||||
rowData[columntitle] = cleantext;
|
rowData[columntitle] = cleantext;
|
||||||
});
|
});
|
||||||
|
|
||||||
data.push(rowData);
|
const rawLesson = rowData.lesson;
|
||||||
|
const lessons = rawLesson.match(/\d+/g).map(Number);
|
||||||
|
for (const lesson of lessons) {
|
||||||
|
rowData.lesson = lesson;
|
||||||
|
data.push(rowData);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
infos.changes = data;
|
infos.changes = data;
|
||||||
|
Reference in New Issue
Block a user