Produce distinct values in aggregated series stats from Postgres

This commit is contained in:
Bogdan 2026-04-23 20:24:55 +03:00 committed by Mark McDowall
parent 39f043a96c
commit 1c34977841

View file

@ -109,9 +109,9 @@ private SqlBuilder EpisodeFilesBuilder()
.Select(@"""SeriesId"",
""SeasonNumber"",
SUM(COALESCE(""Size"", 0)) AS SizeOnDisk,
string_agg(""ReleaseGroup"", '|') AS ReleaseGroupsString,
string_agg(""ReleaseType""::text, '|') AS ReleaseTypesString,
string_agg(""Quality""::json->>'quality', '|') AS EpisodeFileQualitiesString")
string_agg(DISTINCT ""ReleaseGroup"", '|') AS ReleaseGroupsString,
string_agg(DISTINCT ""ReleaseType""::text, '|') AS ReleaseTypesString,
string_agg(DISTINCT ""Quality""::json->>'quality', '|') AS EpisodeFileQualitiesString")
.GroupBy<EpisodeFile>(x => x.SeriesId)
.GroupBy<EpisodeFile>(x => x.SeasonNumber);
}