fix(db): scale TV size bands to episode size (#97)
ci / web (push) Successful in 57s
e2e / e2e (push) Successful in 2m31s
ci / rust (push) Successful in 5m9s

This commit was merged in pull request #97.
This commit is contained in:
2026-08-23 02:31:44 +01:00
parent ad0eb0d9d3
commit 55ae44fa7b
3 changed files with 44 additions and 1 deletions
+33
View File
@@ -477,4 +477,37 @@ mod tests {
let (_dir, db) = seeded().await;
assert!(db.movie_policy(404).await.unwrap().is_none());
}
/// #95: the TV bands used to copy the movie policy's floors verbatim, so a
/// typical 1080p single-episode WEB-DL (1-2 GiB) sat below the 3 GiB movie
/// floor and was hard-filtered outright.
#[tokio::test]
async fn a_single_episode_web_dl_clears_the_tv_floor() {
let (_dir, db) = seeded().await;
sqlx::query(
"INSERT INTO series (tmdb_id, title, root_id)
SELECT 1, 'Fallout', id FROM roots WHERE kind = 'tv' AND audience = 'main'",
)
.execute(db.pool())
.await
.unwrap();
sqlx::query("INSERT INTO seasons (series_id, number) VALUES (1, 1)")
.execute(db.pool())
.await
.unwrap();
sqlx::query("INSERT INTO episodes (season_id, number, title) VALUES (1, 1, 'The End')")
.execute(db.pool())
.await
.unwrap();
let loaded = db.episode_policy(1).await.unwrap().expect("episode 1");
let band = loaded.policy.size_bands[&Resolution::R1080p];
assert_eq!(band.floor_bytes, 1 << 30);
let one_and_a_half_gib = 1536 << 20;
assert_eq!(
arr_core::score::is_below_floor(&loaded.policy, Resolution::R1080p, one_and_a_half_gib),
Some(false)
);
}
}