mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-21 22:15:40 +00:00
23f7ba02d6
* feat(player-stats): local listening history tab with heatmap and summaries Record play sessions in library.sqlite when the library index is enabled, add Rust read APIs and Tauri commands for year/day aggregates, and ship the Player stats UI with session clustering, event-driven live refresh, and a notice when some servers are excluded from indexing. * test(player-stats): split play_session repo and expand test coverage Move the repository into play_session/ (completion, cluster, integration tests), add remap/purge/FK coverage in Rust, and cover ingestion gates plus live-refresh hooks on the frontend per spec v0.3. * docs(release): CHANGELOG and credits for player stats (PR #849) * fix(player-stats): satisfy tsc and clippy CI gates Use InternetRadioStation field names in the radio skip test and replace manual month/day range checks with RangeInclusive::contains.
23 lines
776 B
SQL
23 lines
776 B
SQL
-- Player listening history — see workdocs player-stats spec §3.1
|
|
CREATE TABLE play_session (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
server_id TEXT NOT NULL,
|
|
track_id TEXT NOT NULL,
|
|
started_at_ms INTEGER NOT NULL,
|
|
listened_sec REAL NOT NULL,
|
|
position_max_sec REAL NOT NULL,
|
|
completion TEXT NOT NULL,
|
|
end_reason TEXT NOT NULL,
|
|
FOREIGN KEY (server_id, track_id) REFERENCES track(server_id, id),
|
|
CHECK (completion IN ('partial', 'full'))
|
|
);
|
|
|
|
CREATE INDEX idx_play_session_server_time
|
|
ON play_session(server_id, started_at_ms DESC);
|
|
|
|
CREATE INDEX idx_play_session_track
|
|
ON play_session(server_id, track_id, started_at_ms DESC);
|
|
|
|
CREATE INDEX idx_play_session_started
|
|
ON play_session(started_at_ms DESC);
|