fix: 处理数据问题
This commit is contained in:
BIN
server/data.db
BIN
server/data.db
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -150,6 +150,10 @@ try {
|
||||
if (!lossNames.includes('helicopters')) db.exec('ALTER TABLE combat_losses ADD COLUMN helicopters INTEGER NOT NULL DEFAULT 0')
|
||||
if (!lossNames.includes('submarines')) db.exec('ALTER TABLE combat_losses ADD COLUMN submarines INTEGER NOT NULL DEFAULT 0')
|
||||
if (!lossNames.includes('tanks')) db.exec('ALTER TABLE combat_losses ADD COLUMN tanks INTEGER NOT NULL DEFAULT 0')
|
||||
if (!lossNames.includes('carriers')) {
|
||||
db.exec('ALTER TABLE combat_losses ADD COLUMN carriers INTEGER NOT NULL DEFAULT 0')
|
||||
db.exec('UPDATE combat_losses SET carriers = tanks')
|
||||
}
|
||||
if (!lossNames.includes('civilian_ships')) db.exec('ALTER TABLE combat_losses ADD COLUMN civilian_ships INTEGER NOT NULL DEFAULT 0')
|
||||
if (!lossNames.includes('airport_port')) db.exec('ALTER TABLE combat_losses ADD COLUMN airport_port INTEGER NOT NULL DEFAULT 0')
|
||||
} catch (_) {}
|
||||
|
||||
@@ -149,9 +149,9 @@ function seed() {
|
||||
|
||||
try {
|
||||
db.exec(`
|
||||
INSERT OR REPLACE INTO combat_losses (side, bases_destroyed, bases_damaged, personnel_killed, personnel_wounded, civilian_killed, civilian_wounded, aircraft, warships, armor, vehicles, drones, missiles, helicopters, submarines, tanks, civilian_ships, airport_port) VALUES
|
||||
('us', 0, 27, 127, 384, 18, 52, 2, 0, 0, 8, 4, 12, 1, 0, 0, 0, 0),
|
||||
('iran', 3, 8, 2847, 5620, 412, 1203, 24, 12, 18, 42, 28, 156, 8, 2, 0, 0, 0);
|
||||
INSERT OR REPLACE INTO combat_losses (side, bases_destroyed, bases_damaged, personnel_killed, personnel_wounded, civilian_killed, civilian_wounded, aircraft, warships, armor, vehicles, drones, missiles, helicopters, submarines, tanks, carriers, civilian_ships, airport_port) VALUES
|
||||
('us', 0, 27, 127, 384, 18, 52, 2, 0, 0, 8, 4, 12, 1, 0, 0, 0, 0, 0),
|
||||
('iran', 3, 8, 2847, 5620, 412, 1203, 24, 12, 18, 42, 28, 156, 8, 2, 0, 0, 0, 0);
|
||||
`)
|
||||
} catch (_) {
|
||||
db.exec(`
|
||||
|
||||
@@ -24,7 +24,7 @@ function toLosses(row) {
|
||||
missiles: row.missiles ?? 0,
|
||||
helicopters: row.helicopters ?? 0,
|
||||
submarines: row.submarines ?? 0,
|
||||
tanks: row.tanks ?? 0,
|
||||
carriers: row.carriers ?? row.tanks ?? 0,
|
||||
civilianShips: row.civilian_ships ?? 0,
|
||||
airportPort: row.airport_port ?? 0,
|
||||
}
|
||||
@@ -42,7 +42,7 @@ const defaultLosses = {
|
||||
missiles: 0,
|
||||
helicopters: 0,
|
||||
submarines: 0,
|
||||
tanks: 0,
|
||||
carriers: 0,
|
||||
civilianShips: 0,
|
||||
airportPort: 0,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user