mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 10:01:10 +00:00
Fixes media consumption tracking, statistics, and reader page counting
This commit is contained in:
1 parent
e56712731f
commit
02bcf91661
40 files changed
+298
-168
No files matched your search
+3
-3
@@ -33,8 +33,8 @@ The decision includes these rules:
|
||||
- **Completion is explicit or threshold based.** A session stopped at or after the library completion threshold is recorded as `Completed` and its resume point is deleted. Completion never requires playback to the final second of a media file. A library that tracks progress without a completion threshold completes only when completion is reported explicitly.
|
||||
- **Progress tracking and completion thresholds are per-library settings.** `ShouldTrackConsumptionProgress` and `CompletionThresholdPercentage` live in `LibraryConsumptionSettings` on the library aggregate. Defaults are applied by library type when a library is created, and when progress tracking is enabled later without a threshold. The per-library value always wins once it is set.
|
||||
- **Statistics are derived, never stored.** `ConsumptionStatistics` aggregates the records in the application layer on every request. There is no rollup table, no projection table and no counter aggregate, so deleting a record changes the statistics immediately. The `MediaConsumptionRule` value objects own the counting rules per media kind.
|
||||
- **Tags and genres are lowercase and shared across kinds.** `Tag` and `Genre` normalize names with `Trim().ToLowerInvariant()`, and the statistics group them by that normalized name across media kinds. The application resolves the terms of each consumed record through the catalogue repository of its media kind, in a per-kind branch, and the photo branch is added when the photo catalogue exists.
|
||||
- **Access is based on the user and the administrator role.** A regular user reads and deletes only their own history, statistics and resume points. An administrator reads and deletes any user's history, statistics and resume points. There is no per-user permission toggle. Lifecycle writes (`start`, `progress`, `complete`, `stop`) are owner only, so an administrator does not write another user's session.
|
||||
- **Tags and genres are lowercase and shared across kinds.** `Tag` and `Genre` normalize names with `Trim().ToLowerInvariant()`, and the statistics group them by that normalized name across media kinds. The application resolves the terms of each consumed record through the catalogue repository of its media kind, in a per-kind branch, and the photo branch is added when the photo catalogue exists. For a music track, the terms fall back from the track to its album and then to its artist.
|
||||
- **Access is based on the user and the administrator role.** A regular user reads and deletes only their own history, statistics and resume points. An administrator reads any user's history and statistics, and deletes any user's history and resume points. A resume point is readable only by its owner. There is no per-user permission toggle. Lifecycle writes (`start`, `progress`, `complete`, `stop`) are owner only, so an administrator does not write another user's session.
|
||||
|
||||
### Model
|
||||
|
||||
@@ -73,7 +73,7 @@ The statistics count a session when the rule of its media kind says so. Duration
|
||||
- **Complete**: loads the record of the current user, makes it terminal as `Completed`, and deletes the resume point for the same user, kind and item.
|
||||
- **Stop**: loads the record and the library settings. It stops the record without a threshold check when tracking is off or no threshold is set. When tracking is on and a threshold is set, a final fraction at or above it completes the record and deletes the resume point; otherwise the record is stopped and the resume point is upserted.
|
||||
- **Statistics**: the statistics repository binds the target user and every optional filter and returns read-only record entities. The application handlers aggregate the records, resolve display data and tags or genres through the catalogue repositories, paginate, and map the DTOs.
|
||||
- **Deletion**: deleting a record, every record of an item, or the whole history is idempotent and never deletes resume points. Clearing resume points never deletes history. An administrator may delete any user's history through the per-user routes.
|
||||
- **Deletion**: deleting a record, every record of an item, or the whole history is idempotent and never deletes resume points. Clearing resume points never deletes history. An administrator may delete any user's history or resume points through the per-user routes; reading a resume point stays owner only.
|
||||
|
||||
## Consequences
|
||||
|
||||
|
||||
Reference in new issue
Block a user