Afegir temes coocurrents

This commit is contained in:
marc
2025-10-24 00:05:56 +02:00
parent 31aeb09dd9
commit 1909af9107
10 changed files with 171 additions and 43 deletions

View File

@@ -35,3 +35,11 @@ def temes_compute_stats(temes: Iterable[model.Tema]) -> list[model.Tema]:
tema_ids = [tema.id for tema in temes if tema.id is not None]
tune_sessions_dict = playlists_q.get_tune_sessions(tema_ids=tema_ids)
return [tema_compute_stats(tema=tema, tune_sessions_dict=tune_sessions_dict) for tema in temes]
def tema_compute_played_with(
tema: model.Tema,
) -> model.Tema:
if tema.id:
tema.played_with = playlists_q.get_commonly_played_tunes(tema_id=tema.id)
return tema