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

@ -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,
},
],
},
});