mirror of
https://codeberg.org/icewind/log-normalizer.git
synced 2026-06-03 13:54:11 +02:00
sqlx update + clippy
This commit is contained in:
parent
7d7886d41b
commit
e1a4036b61
29 changed files with 1261 additions and 776 deletions
27
.sqlx/query-0000e8f1c60464bde61980810f4013b3ff71d318291de9d8cf595474f4ee8f32.json
generated
Normal file
27
.sqlx/query-0000e8f1c60464bde61980810f4013b3ff71d318291de9d8cf595474f4ee8f32.json
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO events_round_win(round_id, time, team)VALUES($1, $2, $3)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "0000e8f1c60464bde61980810f4013b3ff71d318291de9d8cf595474f4ee8f32"
|
||||
}
|
||||
72
.sqlx/query-253ca64f81921ad7351335d8b47967a4b6831b16d8128a11b40daa63b31f5a4c.json
generated
Normal file
72
.sqlx/query-253ca64f81921ad7351335d8b47967a4b6831b16d8128a11b40daa63b31f5a4c.json
generated
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO players (log_id, steam_id, name, team, kills, deaths, assists,suicides, dmg, damage_taken, ubers, medigun_ubers,kritzkrieg_ubers, quickfix_ubers, vaccinator_ubers,drops, medkits, medkits_hp, backstabs, headshots,heal, heals_received,scout_kills, soldier_kills, pyro_kills, demoman_kills,heavy_kills, engineer_kills, medic_kills, sniper_kills, spy_kills,\n scout_deaths, soldier_deaths, pyro_deaths, demoman_deaths,heavy_deaths, engineer_deaths, medic_deaths, sniper_deaths, spy_deaths\n )VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,$11, $12, $13, $14, $15, $16, $17, $18, $19, $20,$21, $22, $23, $24, $25, $26, $27, $28, $29, $30,$31, $32, $33, $34, $35, $36, $37, $38, $39, $40)RETURNING id",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int8"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int8",
|
||||
"Text",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "253ca64f81921ad7351335d8b47967a4b6831b16d8128a11b40daa63b31f5a4c"
|
||||
}
|
||||
22
.sqlx/query-25a688892917d80b8746d77ebbcdfb4652c7047d722c530b4560d6008cdd2b97.json
generated
Normal file
22
.sqlx/query-25a688892917d80b8746d77ebbcdfb4652c7047d722c530b4560d6008cdd2b97.json
generated
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT MIN(id) as \"id\" from logs WHERE version < $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int4"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int2"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "25a688892917d80b8746d77ebbcdfb4652c7047d722c530b4560d6008cdd2b97"
|
||||
}
|
||||
51
.sqlx/query-417cfaecb2cb45d16c9da2dc2f8e6d1a37280842a5fc9ffb85b5d1955a54670d.json
generated
Normal file
51
.sqlx/query-417cfaecb2cb45d16c9da2dc2f8e6d1a37280842a5fc9ffb85b5d1955a54670d.json
generated
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO logs(id, red_score, blue_score, length, game_mode, map, type, date, version)VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "game_mode",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"ultiduo",
|
||||
"4v4",
|
||||
"6v6",
|
||||
"7v7",
|
||||
"9v9",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Text",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "map_type",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"stopwatch",
|
||||
"cp",
|
||||
"koth",
|
||||
"ctf",
|
||||
"ultiduo",
|
||||
"bball",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Timestamp",
|
||||
"Int2"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "417cfaecb2cb45d16c9da2dc2f8e6d1a37280842a5fc9ffb85b5d1955a54670d"
|
||||
}
|
||||
19
.sqlx/query-425af9e4b088335acabe4bf74c3b11c0cab5f033b57197c992533889a4d1300d.json
generated
Normal file
19
.sqlx/query-425af9e4b088335acabe4bf74c3b11c0cab5f033b57197c992533889a4d1300d.json
generated
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO player_weapon_stats(class_stat_id, weapon, kills, shots, hits, dmg)VALUES($1, $2, $3, $4, $5, $6)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int8",
|
||||
"Text",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "425af9e4b088335acabe4bf74c3b11c0cab5f033b57197c992533889a4d1300d"
|
||||
}
|
||||
41
.sqlx/query-4dcd86f5ef23f46b5c6cd391522791a609e04e068009678ba95b81cb385b9e89.json
generated
Normal file
41
.sqlx/query-4dcd86f5ef23f46b5c6cd391522791a609e04e068009678ba95b81cb385b9e89.json
generated
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO events_charge(round_id, time, team, medigun, steam_id)VALUES($1, $2, $3, $4, $5)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Custom": {
|
||||
"name": "medigun",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"medigun",
|
||||
"kritzkrieg",
|
||||
"quickfix",
|
||||
"vaccinator"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int8"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "4dcd86f5ef23f46b5c6cd391522791a609e04e068009678ba95b81cb385b9e89"
|
||||
}
|
||||
17
.sqlx/query-581b192c18e54b711d0e3b6d38490984c48320fe4607c7eacc7b9002daaf7771.json
generated
Normal file
17
.sqlx/query-581b192c18e54b711d0e3b6d38490984c48320fe4607c7eacc7b9002daaf7771.json
generated
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO kill_streaks(log_id, steam_id, time, streak)VALUES($1, $2, $3, $4)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int8",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "581b192c18e54b711d0e3b6d38490984c48320fe4607c7eacc7b9002daaf7771"
|
||||
}
|
||||
29
.sqlx/query-7669da21c453d1d4e5d5e7aead5a0fbc4307aba66debd679159374c5647fd0fe.json
generated
Normal file
29
.sqlx/query-7669da21c453d1d4e5d5e7aead5a0fbc4307aba66debd679159374c5647fd0fe.json
generated
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO events_medic_death(round_id, time, team, steam_id, killer)VALUES($1, $2, $3, $4, $5)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int8",
|
||||
"Int8"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "7669da21c453d1d4e5d5e7aead5a0fbc4307aba66debd679159374c5647fd0fe"
|
||||
}
|
||||
28
.sqlx/query-982bc615a035019855317b3b47a3ac10159d81318db323c2d076c9b4c04a4e02.json
generated
Normal file
28
.sqlx/query-982bc615a035019855317b3b47a3ac10159d81318db323c2d076c9b4c04a4e02.json
generated
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO events_drop(round_id, time, team, steam_id)VALUES($1, $2, $3, $4)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int8"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "982bc615a035019855317b3b47a3ac10159d81318db323c2d076c9b4c04a4e02"
|
||||
}
|
||||
15
.sqlx/query-c9f31bcb2cb8b76f7cd2e66284b70f79e462ac70f94cdab022bdce63929731b1.json
generated
Normal file
15
.sqlx/query-c9f31bcb2cb8b76f7cd2e66284b70f79e462ac70f94cdab022bdce63929731b1.json
generated
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "UPDATE logs SET version = $1 WHERE id = $2",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int2",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "c9f31bcb2cb8b76f7cd2e66284b70f79e462ac70f94cdab022bdce63929731b1"
|
||||
}
|
||||
46
.sqlx/query-d4d72675d0a0792d14472c6bfc00454791dea1eae933818d168171f818bb7dc9.json
generated
Normal file
46
.sqlx/query-d4d72675d0a0792d14472c6bfc00454791dea1eae933818d168171f818bb7dc9.json
generated
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO class_stats(player_id, type, time, kills, deaths, assists, dmg)VALUES($1, $2, $3, $4, $5, $6, $7)RETURNING id",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int8"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int8",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "class_type",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"scout",
|
||||
"soldier",
|
||||
"pyro",
|
||||
"demoman",
|
||||
"heavyweapons",
|
||||
"engineer",
|
||||
"medic",
|
||||
"sniper",
|
||||
"spy",
|
||||
"unknown"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "d4d72675d0a0792d14472c6bfc00454791dea1eae933818d168171f818bb7dc9"
|
||||
}
|
||||
56
.sqlx/query-eab40a01c0df317cdfb97eb4f88884f6776897ec2c2ecb8cae05748c8d087711.json
generated
Normal file
56
.sqlx/query-eab40a01c0df317cdfb97eb4f88884f6776897ec2c2ecb8cae05748c8d087711.json
generated
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO rounds(\n round, log_id, length, winner, first_cap, red_score, blue_score,\n red_kills, blue_kills, red_dmg, blue_dmg, red_ubers, blue_ubers\n )\n VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)\n RETURNING id",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int4"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "eab40a01c0df317cdfb97eb4f88884f6776897ec2c2ecb8cae05748c8d087711"
|
||||
}
|
||||
20
.sqlx/query-f4daaeeaaf227491627c0bb54319a5f356028a591fdac2f41ba2dce1c5053d4a.json
generated
Normal file
20
.sqlx/query-f4daaeeaaf227491627c0bb54319a5f356028a591fdac2f41ba2dce1c5053d4a.json
generated
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT MAX(id) as id from logs",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int4"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": []
|
||||
},
|
||||
"nullable": [
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "f4daaeeaaf227491627c0bb54319a5f356028a591fdac2f41ba2dce1c5053d4a"
|
||||
}
|
||||
28
.sqlx/query-f8be06a1f3b2b9755faf3ca32921528528240308ed036cd6cf320ca4d31438b9.json
generated
Normal file
28
.sqlx/query-f8be06a1f3b2b9755faf3ca32921528528240308ed036cd6cf320ca4d31438b9.json
generated
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO events_point_cap(round_id, time, team, point)VALUES($1, $2, $3, $4)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "f8be06a1f3b2b9755faf3ca32921528528240308ed036cd6cf320ca4d31438b9"
|
||||
}
|
||||
839
Cargo.lock
generated
839
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -9,10 +9,10 @@ name = "log-normalizer"
|
|||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
sqlx = { version = "0.6.0", default_features = false, features = ["macros", "postgres", "json", "chrono", "runtime-tokio-rustls", "offline"] }
|
||||
sqlx = { version = "0.7.3", default_features = false, features = ["macros", "postgres", "json", "chrono", "runtime-tokio-rustls"] }
|
||||
dotenv = "0.15.0"
|
||||
main_error = "0.1.2"
|
||||
tokio = { version = "1.20.0", features = ["macros", "time"] }
|
||||
tokio = { version = "1.20.0", features = ["macros", "time", "rt-multi-thread"] }
|
||||
serde = { version = "1.0.140", features = ["derive"] }
|
||||
serde_with = "3.6.1"
|
||||
serde_json = "1.0.82"
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
cargo-edit
|
||||
cargo-outdated
|
||||
cargo-insta
|
||||
sqlx-cli
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
lib,
|
||||
}: let
|
||||
inherit (lib.sources) sourceByRegex;
|
||||
src = sourceByRegex ./. ["Cargo.*" "(src|tests|sqlx-data.json)(/.*)?"];
|
||||
src = sourceByRegex ./. ["Cargo.*" "(src|tests|.sqlx)(/.*)?"];
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "log-normalizer";
|
||||
|
|
|
|||
446
sqlx-data.json
446
sqlx-data.json
|
|
@ -1,446 +0,0 @@
|
|||
{
|
||||
"db": "PostgreSQL",
|
||||
"0000e8f1c60464bde61980810f4013b3ff71d318291de9d8cf595474f4ee8f32": {
|
||||
"query": "INSERT INTO events_round_win(round_id, time, team)VALUES($1, $2, $3)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"253ca64f81921ad7351335d8b47967a4b6831b16d8128a11b40daa63b31f5a4c": {
|
||||
"query": "INSERT INTO players (log_id, steam_id, name, team, kills, deaths, assists,suicides, dmg, damage_taken, ubers, medigun_ubers,kritzkrieg_ubers, quickfix_ubers, vaccinator_ubers,drops, medkits, medkits_hp, backstabs, headshots,heal, heals_received,scout_kills, soldier_kills, pyro_kills, demoman_kills,heavy_kills, engineer_kills, medic_kills, sniper_kills, spy_kills,\n scout_deaths, soldier_deaths, pyro_deaths, demoman_deaths,heavy_deaths, engineer_deaths, medic_deaths, sniper_deaths, spy_deaths\n )VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,$11, $12, $13, $14, $15, $16, $17, $18, $19, $20,$21, $22, $23, $24, $25, $26, $27, $28, $29, $30,$31, $32, $33, $34, $35, $36, $37, $38, $39, $40)RETURNING id",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int8"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int8",
|
||||
"Text",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"25a688892917d80b8746d77ebbcdfb4652c7047d722c530b4560d6008cdd2b97": {
|
||||
"query": "SELECT MIN(id) as \"id\" from logs WHERE version < $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int4"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int2"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
null
|
||||
]
|
||||
}
|
||||
},
|
||||
"417cfaecb2cb45d16c9da2dc2f8e6d1a37280842a5fc9ffb85b5d1955a54670d": {
|
||||
"query": "INSERT INTO logs(id, red_score, blue_score, length, game_mode, map, type, date, version)VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "game_mode",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"ultiduo",
|
||||
"4v4",
|
||||
"6v6",
|
||||
"7v7",
|
||||
"9v9",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Text",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "map_type",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"stopwatch",
|
||||
"cp",
|
||||
"koth",
|
||||
"ctf",
|
||||
"ultiduo",
|
||||
"bball",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Timestamp",
|
||||
"Int2"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"425af9e4b088335acabe4bf74c3b11c0cab5f033b57197c992533889a4d1300d": {
|
||||
"query": "INSERT INTO player_weapon_stats(class_stat_id, weapon, kills, shots, hits, dmg)VALUES($1, $2, $3, $4, $5, $6)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int8",
|
||||
"Text",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"4dcd86f5ef23f46b5c6cd391522791a609e04e068009678ba95b81cb385b9e89": {
|
||||
"query": "INSERT INTO events_charge(round_id, time, team, medigun, steam_id)VALUES($1, $2, $3, $4, $5)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Custom": {
|
||||
"name": "medigun",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"medigun",
|
||||
"kritzkrieg",
|
||||
"quickfix",
|
||||
"vaccinator"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int8"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"581b192c18e54b711d0e3b6d38490984c48320fe4607c7eacc7b9002daaf7771": {
|
||||
"query": "INSERT INTO kill_streaks(log_id, steam_id, time, streak)VALUES($1, $2, $3, $4)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int8",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"7669da21c453d1d4e5d5e7aead5a0fbc4307aba66debd679159374c5647fd0fe": {
|
||||
"query": "INSERT INTO events_medic_death(round_id, time, team, steam_id, killer)VALUES($1, $2, $3, $4, $5)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int8",
|
||||
"Int8"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"982bc615a035019855317b3b47a3ac10159d81318db323c2d076c9b4c04a4e02": {
|
||||
"query": "INSERT INTO events_drop(round_id, time, team, steam_id)VALUES($1, $2, $3, $4)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int8"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"c9f31bcb2cb8b76f7cd2e66284b70f79e462ac70f94cdab022bdce63929731b1": {
|
||||
"query": "UPDATE logs SET version = $1 WHERE id = $2",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int2",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"d4d72675d0a0792d14472c6bfc00454791dea1eae933818d168171f818bb7dc9": {
|
||||
"query": "INSERT INTO class_stats(player_id, type, time, kills, deaths, assists, dmg)VALUES($1, $2, $3, $4, $5, $6, $7)RETURNING id",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int8"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int8",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "class_type",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"scout",
|
||||
"soldier",
|
||||
"pyro",
|
||||
"demoman",
|
||||
"heavyweapons",
|
||||
"engineer",
|
||||
"medic",
|
||||
"sniper",
|
||||
"spy",
|
||||
"unknown"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"eab40a01c0df317cdfb97eb4f88884f6776897ec2c2ecb8cae05748c8d087711": {
|
||||
"query": "INSERT INTO rounds(\n round, log_id, length, winner, first_cap, red_score, blue_score,\n red_kills, blue_kills, red_dmg, blue_dmg, red_ubers, blue_ubers\n )\n VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)\n RETURNING id",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int4"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"f4daaeeaaf227491627c0bb54319a5f356028a591fdac2f41ba2dce1c5053d4a": {
|
||||
"query": "SELECT MAX(id) as id from logs",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int4"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": []
|
||||
},
|
||||
"nullable": [
|
||||
null
|
||||
]
|
||||
}
|
||||
},
|
||||
"f8be06a1f3b2b9755faf3ca32921528528240308ed036cd6cf320ca4d31438b9": {
|
||||
"query": "INSERT INTO events_point_cap(round_id, time, team, point)VALUES($1, $2, $3, $4)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Int4",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "team",
|
||||
"kind": {
|
||||
"Enum": [
|
||||
"blue",
|
||||
"red",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
}
|
||||
}
|
||||
31
src/data.rs
31
src/data.rs
|
|
@ -1,21 +1,16 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Copy, sqlx::Type, Deserialize, Serialize, Eq, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, sqlx::Type, Deserialize, Serialize, Eq, PartialEq, Default)]
|
||||
#[sqlx(type_name = "team")]
|
||||
#[sqlx(rename_all = "lowercase")]
|
||||
pub enum TeamId {
|
||||
Blue,
|
||||
Red,
|
||||
#[serde(other)]
|
||||
#[default]
|
||||
Other,
|
||||
}
|
||||
|
||||
impl Default for TeamId {
|
||||
fn default() -> Self {
|
||||
TeamId::Other
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, sqlx::Type, Deserialize, Serialize, Eq, PartialEq)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[sqlx(rename_all = "lowercase")]
|
||||
|
|
@ -61,7 +56,7 @@ pub enum EventType {
|
|||
Other,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, sqlx::Type, Deserialize, Serialize, Hash, Eq, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, sqlx::Type, Deserialize, Serialize, Hash, Eq, PartialEq, Default)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[sqlx(rename_all = "lowercase")]
|
||||
pub enum Medigun {
|
||||
|
|
@ -69,30 +64,20 @@ pub enum Medigun {
|
|||
QuickFix,
|
||||
Vaccinator,
|
||||
#[serde(other)]
|
||||
#[default]
|
||||
Medigun,
|
||||
}
|
||||
|
||||
impl Default for Medigun {
|
||||
fn default() -> Self {
|
||||
Medigun::Medigun
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, sqlx::Type, Eq, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, sqlx::Type, Eq, PartialEq, Default)]
|
||||
#[sqlx(rename_all = "lowercase")]
|
||||
#[sqlx(type_name = "map_type")]
|
||||
pub enum MapType {
|
||||
Stopwatch,
|
||||
Cp,
|
||||
KOTH,
|
||||
CTF,
|
||||
Koth,
|
||||
Ctf,
|
||||
UltiDuo,
|
||||
BBall,
|
||||
#[default]
|
||||
Other,
|
||||
}
|
||||
|
||||
impl Default for MapType {
|
||||
fn default() -> Self {
|
||||
MapType::Other
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub async fn store_log(pool: &PgPool, id: i32, log: &NormalizedLog) -> Result<()
|
|||
log.info.date() as DateTime<Utc>,
|
||||
2
|
||||
)
|
||||
.execute(&mut tx)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
|
||||
for (num, round) in log.rounds.iter().enumerate() {
|
||||
|
|
@ -48,14 +48,17 @@ pub async fn store_log(pool: &PgPool, id: i32, log: &NormalizedLog) -> Result<()
|
|||
round.team.red.charges as i32,
|
||||
round.team.blue.charges as i32,
|
||||
)
|
||||
.fetch_one(&mut tx)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?
|
||||
.id;
|
||||
|
||||
for event in &round.events {
|
||||
match event {
|
||||
Event::PointCap { time, team, point } => {
|
||||
if let Some(team) = team {
|
||||
Event::PointCap {
|
||||
time,
|
||||
team: Some(team),
|
||||
point,
|
||||
} => {
|
||||
sqlx::query!(
|
||||
"INSERT INTO events_point_cap(round_id, time, team, point)\
|
||||
VALUES($1, $2, $3, $4)",
|
||||
|
|
@ -64,30 +67,29 @@ pub async fn store_log(pool: &PgPool, id: i32, log: &NormalizedLog) -> Result<()
|
|||
*team as TeamId,
|
||||
*point as i32,
|
||||
)
|
||||
.execute(&mut tx)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
Event::RoundWin { time, team } => {
|
||||
if let Some(team) = team {
|
||||
Event::RoundWin {
|
||||
time,
|
||||
team: Some(team),
|
||||
} => {
|
||||
sqlx::query!(
|
||||
"INSERT INTO events_round_win(round_id, time, team)\
|
||||
VALUES($1, $2, $3)",
|
||||
round_id,
|
||||
*time as i32,
|
||||
team.unwrap_or_default() as TeamId,
|
||||
*team as TeamId,
|
||||
)
|
||||
.execute(&mut tx)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
Event::MedicDeath {
|
||||
time,
|
||||
team,
|
||||
team: Some(team),
|
||||
steamid,
|
||||
killer,
|
||||
} => {
|
||||
if let Some(team) = team {
|
||||
sqlx::query!(
|
||||
"INSERT INTO events_medic_death(round_id, time, team, steam_id, killer)\
|
||||
VALUES($1, $2, $3, $4, $5)",
|
||||
|
|
@ -97,16 +99,14 @@ pub async fn store_log(pool: &PgPool, id: i32, log: &NormalizedLog) -> Result<()
|
|||
u64::from(*steamid) as i64,
|
||||
u64::from(*killer) as i64,
|
||||
)
|
||||
.execute(&mut tx)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
Event::Drop {
|
||||
time,
|
||||
steamid,
|
||||
team,
|
||||
team: Some(team),
|
||||
} => {
|
||||
if let Some(team) = team {
|
||||
sqlx::query!(
|
||||
"INSERT INTO events_drop(round_id, time, team, steam_id)\
|
||||
VALUES($1, $2, $3, $4)",
|
||||
|
|
@ -115,17 +115,15 @@ pub async fn store_log(pool: &PgPool, id: i32, log: &NormalizedLog) -> Result<()
|
|||
*team as TeamId,
|
||||
u64::from(*steamid) as i64,
|
||||
)
|
||||
.execute(&mut tx)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
Event::Charge {
|
||||
medigun,
|
||||
time,
|
||||
steamid,
|
||||
team,
|
||||
team: Some(team),
|
||||
} => {
|
||||
if let Some(team) = team {
|
||||
sqlx::query!(
|
||||
"INSERT INTO events_charge(round_id, time, team, medigun, steam_id)\
|
||||
VALUES($1, $2, $3, $4, $5)",
|
||||
|
|
@ -135,10 +133,9 @@ pub async fn store_log(pool: &PgPool, id: i32, log: &NormalizedLog) -> Result<()
|
|||
*medigun as Medigun,
|
||||
u64::from(*steamid) as i64,
|
||||
)
|
||||
.execute(&mut tx)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
@ -234,7 +231,7 @@ pub async fn store_log(pool: &PgPool, id: i32, log: &NormalizedLog) -> Result<()
|
|||
deaths.sniper as i32,
|
||||
deaths.spy as i32,
|
||||
)
|
||||
.fetch_one(&mut tx)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?
|
||||
.id;
|
||||
|
||||
|
|
@ -252,7 +249,7 @@ pub async fn store_log(pool: &PgPool, id: i32, log: &NormalizedLog) -> Result<()
|
|||
class.assists as i32,
|
||||
class.dmg as i32,
|
||||
)
|
||||
.fetch_one(&mut tx)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?
|
||||
.id;
|
||||
|
||||
|
|
@ -267,7 +264,7 @@ pub async fn store_log(pool: &PgPool, id: i32, log: &NormalizedLog) -> Result<()
|
|||
stats.hits as i32,
|
||||
stats.dmg as i32,
|
||||
)
|
||||
.execute(&mut tx)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
|
@ -284,7 +281,7 @@ pub async fn store_log(pool: &PgPool, id: i32, log: &NormalizedLog) -> Result<()
|
|||
kill_streak.time,
|
||||
kill_streak.streak,
|
||||
)
|
||||
.execute(&mut tx)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
|
||||
|
|
@ -313,13 +310,13 @@ pub async fn upgrade(
|
|||
kill_streak.time,
|
||||
kill_streak.streak,
|
||||
)
|
||||
.execute(&mut tx)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
sqlx::query!("UPDATE logs SET version = $1 WHERE id = $2", to, id)
|
||||
.execute(&mut tx)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
|
||||
tx.commit().await?;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ fn is_valid(value: &serde_json::Value) -> bool {
|
|||
if value.get("success").is_none() {
|
||||
return false;
|
||||
}
|
||||
if value.get("success").unwrap().as_bool().unwrap_or_default() == false {
|
||||
if !value.get("success").unwrap().as_bool().unwrap_or_default() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ pub use crate::raw::{
|
|||
};
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use serde::Deserialize;
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashMap;
|
||||
use steamid_ng::SteamID;
|
||||
|
||||
|
|
@ -75,9 +76,9 @@ impl Info {
|
|||
} else if self.map.starts_with("cp") {
|
||||
MapType::Cp
|
||||
} else if self.map.starts_with("koth") {
|
||||
MapType::KOTH
|
||||
MapType::Koth
|
||||
} else if self.map.starts_with("ctf") {
|
||||
MapType::CTF
|
||||
MapType::Ctf
|
||||
} else if self.map.starts_with("ultiduo") {
|
||||
MapType::UltiDuo
|
||||
} else if self.map.starts_with("bball") {
|
||||
|
|
@ -88,7 +89,9 @@ impl Info {
|
|||
}
|
||||
|
||||
pub fn date(&self) -> DateTime<Utc> {
|
||||
DateTime::from_utc(NaiveDateTime::from_timestamp(self.date as i64, 0), Utc)
|
||||
NaiveDateTime::from_timestamp_opt(self.date as i64, 0)
|
||||
.unwrap()
|
||||
.and_utc()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +136,7 @@ impl From<RawLog> for NormalizedLog {
|
|||
.or(raw.info.rounds)
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.map(|raw| Round::from(raw))
|
||||
.map(Round::from)
|
||||
.collect();
|
||||
let teams = raw.teams.or(raw.info.teams).unwrap_or_default();
|
||||
|
||||
|
|
@ -188,33 +191,18 @@ impl From<crate::raw::Round> for Round {
|
|||
}
|
||||
|
||||
pub fn map_is_stopwatch(map: &str) -> bool {
|
||||
if map.starts_with("pl_") {
|
||||
true
|
||||
} else if map.starts_with("cp_steel") {
|
||||
true
|
||||
} else if map.starts_with("cp_gravelpit") {
|
||||
true
|
||||
} else if map.starts_with("cp_dustbowl") {
|
||||
true
|
||||
} else if map.starts_with("cp_egypt") {
|
||||
true
|
||||
} else if map.starts_with("cp_degrootkeep") {
|
||||
true
|
||||
} else if map.starts_with("cp_gorge") {
|
||||
true
|
||||
} else if map.starts_with("cp_junction") {
|
||||
true
|
||||
} else if map.starts_with("cp_mossrock") {
|
||||
true
|
||||
} else if map.starts_with("cp_manor") {
|
||||
true
|
||||
} else if map.starts_with("cp_snowplow") {
|
||||
true
|
||||
} else if map.starts_with("cp_alloy") {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
map.starts_with("pl_")
|
||||
|| map.starts_with("cp_steel")
|
||||
|| map.starts_with("cp_gravelpit")
|
||||
|| map.starts_with("cp_dustbowl")
|
||||
|| map.starts_with("cp_egypt")
|
||||
|| map.starts_with("cp_degrootkeep")
|
||||
|| map.starts_with("cp_gorge")
|
||||
|| map.starts_with("cp_junction")
|
||||
|| map.starts_with("cp_mossrock")
|
||||
|| map.starts_with("cp_manor")
|
||||
|| map.starts_with("cp_snowplow")
|
||||
|| map.starts_with("cp_alloy")
|
||||
}
|
||||
|
||||
/// Add missing round wins for 2nd round blue win
|
||||
|
|
@ -273,7 +261,7 @@ fn get_first_event_time(round: &Round) -> u32 {
|
|||
round
|
||||
.events
|
||||
.iter()
|
||||
.filter_map(|event| Some(event.time()))
|
||||
.map(|event| event.time())
|
||||
.last()
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
|
@ -327,13 +315,16 @@ fn normalize_stopwatch_score(log: &mut NormalizedLog) {
|
|||
let second_half_capped = get_round_point_capped(&log.rounds[1]);
|
||||
|
||||
// "blue" is the team that attacked first
|
||||
if first_half_capped > second_half_capped {
|
||||
match first_half_capped.cmp(&second_half_capped) {
|
||||
Ordering::Greater => {
|
||||
log.teams.blue.score = 1;
|
||||
log.teams.red.score = 0;
|
||||
} else if second_half_capped > first_half_capped {
|
||||
}
|
||||
Ordering::Less => {
|
||||
log.teams.blue.score = 0;
|
||||
log.teams.red.score = 1;
|
||||
} else {
|
||||
}
|
||||
Ordering::Equal => {
|
||||
let first_half_cap_time = get_last_cap_time(&log.rounds[0]);
|
||||
let second_half_cap_time = get_last_cap_time(&log.rounds[1])
|
||||
.saturating_sub(get_round_end_time(&log.rounds[0]));
|
||||
|
|
@ -348,6 +339,7 @@ fn normalize_stopwatch_score(log: &mut NormalizedLog) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ pub enum Event {
|
|||
},
|
||||
RoundWin {
|
||||
time: u32,
|
||||
team: Option<Option<TeamId>>,
|
||||
team: Option<TeamId>,
|
||||
},
|
||||
Drop {
|
||||
time: u32,
|
||||
|
|
|
|||
|
|
@ -1167,7 +1167,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 754,
|
||||
team: Some(Some(Red)),
|
||||
team: Some(Red),
|
||||
),
|
||||
],
|
||||
"firstcap": None,
|
||||
|
|
@ -1286,7 +1286,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 168,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": None,
|
||||
|
|
@ -1415,7 +1415,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 173,
|
||||
team: Some(Some(Red)),
|
||||
team: Some(Red),
|
||||
),
|
||||
],
|
||||
"firstcap": None,
|
||||
|
|
@ -1554,7 +1554,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 127,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": None,
|
||||
|
|
@ -1676,7 +1676,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 108,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": None,
|
||||
|
|
@ -1884,7 +1884,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 520,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": None,
|
||||
|
|
@ -2068,7 +2068,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 235,
|
||||
team: Some(Some(Red)),
|
||||
team: Some(Red),
|
||||
),
|
||||
],
|
||||
"firstcap": None,
|
||||
|
|
@ -2174,7 +2174,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 88,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": None,
|
||||
|
|
|
|||
|
|
@ -1167,7 +1167,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 778,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
@ -1384,7 +1384,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 1349,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
|
|||
|
|
@ -1352,7 +1352,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 959,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
@ -1570,7 +1570,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 1299,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
|
|||
|
|
@ -747,7 +747,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 116,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
@ -866,7 +866,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 267,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
@ -986,7 +986,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 366,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
@ -1166,7 +1166,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 645,
|
||||
team: Some(Some(Red)),
|
||||
team: Some(Red),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
@ -1279,7 +1279,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 779,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
@ -1411,7 +1411,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 1003,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
|
|||
|
|
@ -1304,7 +1304,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 645,
|
||||
team: Some(Some(Blue)),
|
||||
team: Some(Blue),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
@ -1565,7 +1565,7 @@ RawLog(
|
|||
Event(
|
||||
type: "round_win",
|
||||
time: 1296,
|
||||
team: Some(Some(Red)),
|
||||
team: Some(Red),
|
||||
),
|
||||
],
|
||||
"firstcap": Some(Blue),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue