Playtime records from pt_events; sticky top bar, page scroll locked under the drawer

Records: the most bomb plants, defuses, knife, Zeus and headshot kills for
the last 7 days, 30 days or all time, and each player's counts, when
PlaytimeHistory 0.2.0's pt_events is there. The public site's top bar now
sticks the whole way down, Playtime comes after Server, and only the
player drawer scrolls while it's open.
This commit is contained in:
Astra 2026-10-04 21:37:42 +01:00
parent 6d0fc6e463
commit 7004945d49
9 changed files with 296 additions and 27 deletions

View file

@ -1,4 +1,4 @@
-- A copy of PlaytimeHistory's Migrations/001_CreateTables.sql (plugins/PlaytimeHistory, 0.1.0), for
-- A copy of PlaytimeHistory's Migrations/*.sql (plugins/PlaytimeHistory, 0.2.0), in order, for
-- playtime_db_test.go. Keep it in step with the plugin's migrations.
-- All times are UTC. Tables are prefixed pt_ so they can share a database if ever needed.
@ -139,3 +139,36 @@ WITH RECURSIVE h AS (
SELECT steamid64, server_id, map, team, alive, hour_start,
TIMESTAMPDIFF(SECOND, piece_start, LEAST(ended_at, hour_start + INTERVAL 1 HOUR)) AS seconds
FROM h;
-- Migrations/002_Events.sql (0.2.0)
-- One row per kill, bomb plant and bomb defuse, written as it happens (0.2.0+). Nothing during
-- warmup. Kills leave out suicides and team kills.
-- kind: 1 kill, 2 bomb planted, 3 bomb defused. steamid64 is who did it: the killer, planter or
-- defuser. The kill-only columns are NULL for plants and defuses, and site is NULL for kills.
-- victim_steamid64 is NULL when the victim was a bot (victim_bot 1).
CREATE TABLE IF NOT EXISTS `pt_events` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`event_key` char(32) NOT NULL,
`server_id` int NOT NULL,
`session_key` char(32) NULL,
`steamid64` bigint unsigned NOT NULL,
`kind` tinyint NOT NULL,
`at` datetime NOT NULL,
`map` varchar(64) NOT NULL,
`team` tinyint NOT NULL,
`weapon` varchar(64) NULL,
`headshot` tinyint NULL,
`noscope` tinyint NULL,
`thrusmoke` tinyint NULL,
`wallbang` tinyint NULL,
`blind` tinyint NULL,
`victim_steamid64` bigint unsigned NULL,
`victim_bot` tinyint NULL,
`site` int NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_event_key` (`event_key`),
KEY `ix_kind_at` (`kind`, `at`),
KEY `ix_steamid_at` (`steamid64`, `at`),
KEY `ix_at` (`at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;