add GainExperience listeners

This commit is contained in:
41666 2023-05-28 13:07:05 -04:00
parent 24437b5520
commit 738d2975ec
5 changed files with 151 additions and 13 deletions

View file

@ -14,5 +14,11 @@ sqlx = { version = "0.6.2", default_features = false, features = [ "runtime-toki
tokio = { version = "1.24.2", features = ["macros", "rt-multi-thread"] }
tower-http = { version = "0.3.5", features = ["cors"] }
lazy_static = "1.4.0"
reqwest = "0.11.14"
chrono = "0.4.23"
reqwest = { version = "0.11.14", features = ["rustls-tls-webpki-roots"] }
chrono = "0.4.23"
[dependencies.openssl]
version = "0.10.29"
features = [
"vendored"
]

View file

@ -24,7 +24,7 @@ impl Analytics {
) -> Vec<Event> {
let pool = ctx.data::<Pool<Postgres>>().unwrap();
let sql = format!("SELECT time_bucket_gapfill('{} seconds', time, start => now() - '{}'::interval, finish => now()) AS bucket, CASE WHEN count(*) IS NULL THEN 0 ELSE count(*) END AS count, event_name, world_id FROM analytics WHERE time > now() - '{}'::interval {} GROUP BY bucket, world_id, event_name ORDER BY bucket ASC",
let sql = format!("SELECT time_bucket_gapfill('{} seconds', time, start => now() - '{}'::interval, finish => now()) AS bucket, CASE WHEN count(*) IS NULL THEN 0 ELSE count(*) END AS count, event_name, world_id FROM analytics WHERE event_name IN ('Death', 'VehicleDestroy', 'GainExperience') AND time > now() - '{}'::interval {} GROUP BY bucket, world_id, event_name ORDER BY bucket ASC",
if hi_precision {
5
} else {

View file

@ -207,7 +207,7 @@
acc[ev.eventName][ev.time] = (acc[ev.time] || 0) + ev.count;
return acc;
},
{ Death: {}, VehicleDestroy: {} }
{ Death: {}, VehicleDestroy: {}, GainExperience: {} }
);
new Chart(document.getElementById(id), {
@ -228,6 +228,10 @@
label: "Vehicle Destroys",
data: allEvents.VehicleDestroy,
},
{
label: "Experience Events",
data: allEvents.GainExperience,
},
],
},
});