feat: richer profile stats, wrapup min-count filter, watch medium distribution
Some checks failed
CI / Check / Test (push) Has been cancelled

- filter wrapup top directors/actors with count < 2
- add watch_medium to wrapup report + adapters
- profile trends: genre breakdown, rating histogram, watch medium dist
- fix unused StarDisplay import in movie detail
This commit is contained in:
2026-07-10 21:38:08 +02:00
parent 498f3b1818
commit 587dcc04de
20 changed files with 411 additions and 85 deletions

View File

@@ -4,7 +4,7 @@ mod feed;
mod movie;
mod refresh_session;
mod review;
mod stats;
pub mod stats;
mod user;
pub mod collections;
@@ -26,7 +26,7 @@ pub use federation::*;
pub use feed::*;
pub use movie::*;
pub use review::*;
pub use stats::*;
pub use stats::{DirectorStat, MonthActivity, MonthlyRating, MovieStats, UserStats, UserTrends};
pub use user::*;
pub use goal::{Goal, GoalWithProgress};

View File

@@ -30,11 +30,26 @@ pub struct DirectorStat {
pub count: i64,
}
#[derive(Clone, Debug)]
pub struct GenreStat {
pub genre: String,
pub count: i64,
}
#[derive(Clone, Debug)]
pub struct WatchMediumStat {
pub medium: String,
pub count: i64,
}
#[derive(Clone, Debug)]
pub struct UserTrends {
pub monthly_ratings: Vec<MonthlyRating>,
pub top_directors: Vec<DirectorStat>,
pub max_director_count: i64,
pub top_genres: Vec<GenreStat>,
pub rating_distribution: [i64; 5],
pub watch_medium_distribution: Vec<WatchMediumStat>,
}
#[derive(Clone, Debug)]

View File

@@ -17,6 +17,7 @@ pub struct WrapUpMovieRow {
pub runtime_minutes: Option<u32>,
pub budget_usd: Option<i64>,
pub original_language: Option<String>,
pub watch_medium: Option<String>,
pub genres: Vec<String>,
pub keywords: Vec<String>,
pub cast_names: Vec<(String, u32, i64)>,
@@ -95,6 +96,12 @@ pub struct LangStat {
pub count: u32,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct WatchMediumStat {
pub medium: String,
pub count: u32,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct MonthCount {
pub year_month: String,
@@ -142,6 +149,7 @@ pub struct WrapUpReport {
pub total_budget_watched: Option<i64>,
pub avg_budget: Option<i64>,
pub language_distribution: Vec<LangStat>,
pub watch_medium_distribution: Vec<WatchMediumStat>,
pub oldest_movie: Option<MovieRef>,
pub newest_movie: Option<MovieRef>,