1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Revert "Fixed: Size on disk calculation including multi-episode files multiple times"

This reverts commit be98862ce0.
This commit is contained in:
Mark McDowall 2022-12-14 08:01:56 -08:00
parent be98862ce0
commit f15f08e51a
2 changed files with 1 additions and 22 deletions

View File

@ -4,7 +4,6 @@
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Languages;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Qualities;
@ -181,25 +180,5 @@ public void should_have_size_on_disk_when_episode_file_exists()
stats.Should().HaveCount(1);
stats.First().SizeOnDisk.Should().Be(_episodeFile.Size);
}
[Test]
public void should_not_duplicate_size_for_multi_episode_files()
{
GivenEpisodeWithFile();
GivenEpisode();
GivenEpisodeFile();
var episode2 = _episode.JsonClone();
episode2.Id = 0;
episode2.EpisodeNumber += 1;
Db.Insert(episode2);
var stats = Subject.SeriesStatistics();
stats.Should().HaveCount(1);
stats.First().SizeOnDisk.Should().Be(_episodeFile.Size);
}
}
}

View File

@ -55,7 +55,7 @@ private SqlBuilder Builder(DateTime currentDate)
return new SqlBuilder()
.Select(@"Episodes.SeriesId AS SeriesId,
Episodes.SeasonNumber,
SUM(COALESCE(EpisodeFiles.Size, 0)) * COUNT(DISTINCT EpisodeFiles.Id) / COUNT(EpisodeFiles.Id) AS SizeOnDisk,
SUM(COALESCE(EpisodeFiles.Size, 0)) AS SizeOnDisk,
GROUP_CONCAT(EpisodeFiles.ReleaseGroup, '|') AS ReleaseGroupsString,
COUNT(*) AS TotalEpisodeCount,
SUM(CASE WHEN AirdateUtc <= @currentDate OR EpisodeFileId > 0 THEN 1 ELSE 0 END) AS AvailableEpisodeCount,