mirror of https://github.com/Radarr/Radarr
Fixed: Quality Profile group order no longer used when ordering results
This commit is contained in:
parent
ab7bb610a6
commit
0800029713
|
@ -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>()
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue