refactor: remove renamed cfs property from ConfigStep

It isn't used
recyclarr
Robert Dailey 4 years ago
parent 47fa66bb79
commit 2a222ac6e5

@ -40,7 +40,6 @@ namespace Trash.Tests.Radarr.CustomFormat.Processors.GuideSteps
var processor = new ConfigStep();
processor.Process(testProcessedCfs, testConfig);
processor.RenamedCustomFormats.Should().BeEmpty();
processor.CustomFormatsNotInGuide.Should().BeEmpty();
processor.ConfigData.Should().BeEquivalentTo(new List<ProcessedConfigData>
{
@ -113,7 +112,6 @@ namespace Trash.Tests.Radarr.CustomFormat.Processors.GuideSteps
var processor = new ConfigStep();
processor.Process(testProcessedCfs, testConfig);
processor.RenamedCustomFormats.Should().BeEmpty();
processor.CustomFormatsNotInGuide.Should().BeEmpty();
processor.ConfigData.Should().BeEquivalentTo(new List<ProcessedConfigData>
{
@ -149,7 +147,6 @@ namespace Trash.Tests.Radarr.CustomFormat.Processors.GuideSteps
var processor = new ConfigStep();
processor.Process(testProcessedCfs, testConfig);
processor.RenamedCustomFormats.Should().BeEmpty();
processor.CustomFormatsNotInGuide.Should().BeEquivalentTo(new List<string> {"name3"}, op => op
.Using<JToken>(jctx => jctx.Subject.Should().BeEquivalentTo(jctx.Expectation))
.WhenTypeIs<JToken>());
@ -166,46 +163,5 @@ namespace Trash.Tests.Radarr.CustomFormat.Processors.GuideSteps
.Using<JToken>(jctx => jctx.Subject.Should().BeEquivalentTo(jctx.Expectation))
.WhenTypeIs<JToken>());
}
[Test]
public void Custom_formats_with_same_trash_id_and_same_name_in_cache_are_in_renamed_list()
{
var testProcessedCfs = new List<ProcessedCustomFormatData>
{
new("name1", "id1", new JObject())
{
CacheEntry = new TrashIdMapping("id1", "name2")
},
new("name2", "id2", new JObject())
{
CacheEntry = new TrashIdMapping("id2", "name1")
}
};
var testConfig = new CustomFormatConfig[]
{
new()
{
Names = new List<string> {"name1", "name2"}
}
};
var processor = new ConfigStep();
processor.Process(testProcessedCfs, testConfig);
processor.RenamedCustomFormats.Should().BeEquivalentTo(testProcessedCfs, op => op
.Using<JToken>(jctx => jctx.Subject.Should().BeEquivalentTo(jctx.Expectation))
.WhenTypeIs<JToken>());
processor.CustomFormatsNotInGuide.Should().BeEmpty();
processor.ConfigData.Should().BeEquivalentTo(new List<ProcessedConfigData>
{
new()
{
CustomFormats = testProcessedCfs
}
}, op => op
.Using<JToken>(jctx => jctx.Subject.Should().BeEquivalentTo(jctx.Expectation))
.WhenTypeIs<JToken>());
}
}
}

@ -8,7 +8,6 @@ namespace Trash.Radarr.CustomFormat.Processors.GuideSteps
{
public class ConfigStep : IConfigStep
{
public List<ProcessedCustomFormatData> RenamedCustomFormats { get; private set; } = new();
public List<string> CustomFormatsNotInGuide { get; } = new();
public List<ProcessedConfigData> ConfigData { get; } = new();
@ -40,28 +39,6 @@ namespace Trash.Radarr.CustomFormat.Processors.GuideSteps
QualityProfiles = configCf.QualityProfiles
});
}
var allCfs = ConfigData
.SelectMany(cd => cd.CustomFormats.Select(cf => cf))
.Distinct()
.ToList();
// List of CFs in cache vs guide that have mismatched Trash ID. This means that a CF was renamed
// to the same name as a previous CF's name, and we should treat that one as missing.
// CustomFormatsSameNameDiffTrashId = allCfs
// .Where(cf => cf.CacheEntry != null)
// .GroupBy(cf => allCfs.FirstOrDefault(
// cf2 => cf2.Name.EqualsIgnoreCase(cf.CacheEntry!.CustomFormatName) &&
// !cf2.TrashId.EqualsIgnoreCase(cf.CacheEntry.TrashId)))
// .Where(grp => grp.Key != null)
// .Select(grp => grp.Append(grp.Key!).ToList())
// .ToList();
// CFs in the guide that match the same TrashID in cache but have different names. Warn the user that it
// is renamed in the guide and they need to update their config.
RenamedCustomFormats = allCfs
.Where(cf => cf.CacheEntry != null && !cf.CacheEntry.CustomFormatName.EqualsIgnoreCase(cf.Name))
.ToList();
}
}
}

@ -5,7 +5,6 @@ namespace Trash.Radarr.CustomFormat.Processors.GuideSteps
{
public interface IConfigStep
{
List<ProcessedCustomFormatData> RenamedCustomFormats { get; }
List<string> CustomFormatsNotInGuide { get; }
List<ProcessedConfigData> ConfigData { get; }

Loading…
Cancel
Save