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:
parent
be98862ce0
commit
f15f08e51a
@ -4,7 +4,6 @@
|
|||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Extensions;
|
|
||||||
using NzbDrone.Core.Languages;
|
using NzbDrone.Core.Languages;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
@ -181,25 +180,5 @@ public void should_have_size_on_disk_when_episode_file_exists()
|
|||||||
stats.Should().HaveCount(1);
|
stats.Should().HaveCount(1);
|
||||||
stats.First().SizeOnDisk.Should().Be(_episodeFile.Size);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ private SqlBuilder Builder(DateTime currentDate)
|
|||||||
return new SqlBuilder()
|
return new SqlBuilder()
|
||||||
.Select(@"Episodes.SeriesId AS SeriesId,
|
.Select(@"Episodes.SeriesId AS SeriesId,
|
||||||
Episodes.SeasonNumber,
|
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,
|
GROUP_CONCAT(EpisodeFiles.ReleaseGroup, '|') AS ReleaseGroupsString,
|
||||||
COUNT(*) AS TotalEpisodeCount,
|
COUNT(*) AS TotalEpisodeCount,
|
||||||
SUM(CASE WHEN AirdateUtc <= @currentDate OR EpisodeFileId > 0 THEN 1 ELSE 0 END) AS AvailableEpisodeCount,
|
SUM(CASE WHEN AirdateUtc <= @currentDate OR EpisodeFileId > 0 THEN 1 ELSE 0 END) AS AvailableEpisodeCount,
|
||||||
|
Loading…
Reference in New Issue
Block a user