Bugfix database creation

This commit is contained in:
2024-11-12 05:09:54 +01:00
parent af26e64ad8
commit 860432ead3
6 changed files with 30 additions and 20 deletions

View File

@@ -148,8 +148,6 @@ export async function prepopulateDatabase() {
capacity++
}
await Seat.bulkCreate(seats)
})
}
else
@@ -159,20 +157,20 @@ export async function prepopulateDatabase() {
for (let row = 0; row < location.rows; row++) {
seatRows.push({
row: row + 1,
SeatGroupId: seatGroup.dataValues.id
seatGroupId: seatGroup.dataValues.id
})
}
await SeatRow.bulkCreate(seatRows)
.then(seatRowRes => {
for (let seatRow of seatRowRes) {
for (let col = 0; col < seatGroup.capacity / location.rows; col++) {
for (let col = 0; col < seatGroup.dataValues.capacity / location.rows; col++) {
seats.push({
seatNr: col,
seatRowId: seatRow.id
})
seatNr: col,
seatRowId: seatRow.dataValues.id
})
capacity++
capacity++
}
}
})

View File

@@ -30,7 +30,7 @@ app.use('/static', express.static(path.join(__dirname, 'images')))
// Add delay for more realistic response times
app.use((req, res, next) => {
setTimeout(next, Math.floor((Math.random () * 2000) + 100))
setTimeout(next, Math.floor((Math.random() * 1000) + 100))
})
// Routes