Fixed: Quality Profile group order no longer used when ordering results

This commit is contained in:
Qstick 2020-08-29 01:12:43 -04:00
parent ab7bb610a6
commit 0800029713
3 changed files with 6 additions and 7 deletions

View File

@ -52,7 +52,6 @@ namespace NzbDrone.Core.Test.Qualities
} }
[Test] [Test]
[Ignore("Doesn't work")]
public void init_should_remove_old_definitions() public void init_should_remove_old_definitions()
{ {
Mocker.GetMock<IQualityDefinitionRepository>() Mocker.GetMock<IQualityDefinitionRepository>()

View File

@ -38,12 +38,12 @@ namespace NzbDrone.Core.Profiles
return lastAllowed.Items.Last().Quality; return lastAllowed.Items.Last().Quality;
} }
public QualityIndex GetIndex(Quality quality) public QualityIndex GetIndex(Quality quality, bool respectGroupOrder = false)
{ {
return GetIndex(quality.Id); return GetIndex(quality.Id, respectGroupOrder);
} }
public QualityIndex GetIndex(int id) public QualityIndex GetIndex(int id, bool respectGroupOrder = false)
{ {
for (var i = 0; i < Items.Count; i++) for (var i = 0; i < Items.Count; i++)
{ {
@ -68,7 +68,7 @@ namespace NzbDrone.Core.Profiles
if (groupItem.Quality.Id == id) if (groupItem.Quality.Id == id)
{ {
return new QualityIndex(i, g); return respectGroupOrder ? new QualityIndex(i, g) : new QualityIndex(i);
} }
} }
} }

View File

@ -31,8 +31,8 @@ namespace NzbDrone.Core.Qualities
public int Compare(Quality left, Quality right, bool respectGroupOrder) public int Compare(Quality left, Quality right, bool respectGroupOrder)
{ {
var leftIndex = _profile.GetIndex(left); var leftIndex = _profile.GetIndex(left, respectGroupOrder);
var rightIndex = _profile.GetIndex(right); var rightIndex = _profile.GetIndex(right, respectGroupOrder);
return leftIndex.CompareTo(rightIndex, respectGroupOrder); return leftIndex.CompareTo(rightIndex, respectGroupOrder);
} }