main screen works again, will come back to database.

duplicated placement data in the attribution table and the ledger scores
table. Means that setting placement in the attribution table is
meaningless. Probably best to remove the placement in the attribution,
or have it reference the placement in the ledger, else return 0. That
would mean that the only way to change the scores is in the ledger,
which is basically what I want, but also if the db dies then there's not
really anything that I can do to recover the scores (same is true for
the attribute table, but I can seed that so it doesn't matter as much).
To get around that, I would need to add seeding the ledger to a seperate
command, which defeats the point of a ledger.

Just add a way to import and export the whole ledger to csv, dumbass.
This commit is contained in:
2026-05-06 16:16:32 +01:00
parent 16acfd2b05
commit 8afc181b86
5 changed files with 14 additions and 91 deletions

View File

@@ -148,20 +148,22 @@ async function seed() {
for (const row of eventAttributionsCSV) {
const eventId = eventMap.get(row.eventID);
const playerId = playerMap.get(row.playerID);
const placement = parseInt(row.placement);
if (!eventId) throw new Error(`Event "${row.eventID}" not found`);
if (!playerId) throw new Error(`Player "${row.playerID}" not found`);
if (placement <= 0) continue;
const result = await db
.insert(schema.eventAttributions)
.values({
eventID: eventId,
playerID: playerId,
placement: 0
placement
})
.returning();
console.log(
` Inserted attribution: event=${row.eventID}, player=${row.playerID}, placement=0 (blank)`
` Inserted attribution: event=${row.eventID}, player=${row.playerID}, placement=${placement}`
);
}