Wipe placements before adding new ones from source

This commit is contained in:
Kalle
2023-04-23 01:01:28 +03:00
parent cdabe79032
commit c83b967b8d

View File

@@ -33,6 +33,7 @@ void main();
async function main() {
const placements: Placements = [];
wipeMonthYearPlacements(resolveMonthYear(jsonNumber));
for (const mode of modes) {
for (const region of regions) {
for (const includeWeapon of [false]) {
@@ -180,3 +181,19 @@ function addPlacements(placements: Placements) {
}
})();
}
function wipeMonthYearPlacements({
month,
year,
}: {
month: number;
year: number;
}) {
const wipeMonthYearPlacementsStm = sql.prepare(/* sql */ `
delete from "XRankPlacement"
where "month" = @month
and "year" = @year
`);
wipeMonthYearPlacementsStm.run({ month, year });
}