mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
Fixed: Inversion of defaults in CDH migration.
This commit is contained in:
parent
c3837c9f7b
commit
dab1834960
@ -37,8 +37,8 @@ public void should_set_cdh_to_enabled()
|
||||
var items = db.Query<DownloadClientDefinition158>("SELECT * FROM DownloadClients");
|
||||
|
||||
items.Should().HaveCount(1);
|
||||
items.First().RemoveCompletedDownloads.Should().BeTrue();
|
||||
items.First().RemoveFailedDownloads.Should().BeFalse();
|
||||
items.First().RemoveCompletedDownloads.Should().BeFalse();
|
||||
items.First().RemoveFailedDownloads.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -49,7 +49,7 @@ public void should_set_cdh_to_disabled_when_globally_disabled()
|
||||
c.Insert.IntoTable("Config").Row(new
|
||||
{
|
||||
Key = "removecompleteddownloads",
|
||||
Value = "False"
|
||||
Value = "True"
|
||||
});
|
||||
|
||||
c.Insert.IntoTable("DownloadClients").Row(new
|
||||
@ -71,8 +71,8 @@ public void should_set_cdh_to_disabled_when_globally_disabled()
|
||||
var items = db.Query<DownloadClientDefinition158>("SELECT * FROM DownloadClients");
|
||||
|
||||
items.Should().HaveCount(1);
|
||||
items.First().RemoveCompletedDownloads.Should().BeFalse();
|
||||
items.First().RemoveFailedDownloads.Should().BeFalse();
|
||||
items.First().RemoveCompletedDownloads.Should().BeTrue();
|
||||
items.First().RemoveFailedDownloads.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -100,7 +100,7 @@ public void should_disable_remove_for_existing_rtorrent()
|
||||
|
||||
items.Should().HaveCount(1);
|
||||
items.First().RemoveCompletedDownloads.Should().BeFalse();
|
||||
items.First().RemoveFailedDownloads.Should().BeFalse();
|
||||
items.First().RemoveFailedDownloads.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,19 +21,19 @@ protected override void MainDbUpgrade()
|
||||
|
||||
private void MoveRemoveSettings(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
var removeCompletedDownloads = true;
|
||||
var removeFailedDownloads = false;
|
||||
var removeCompletedDownloads = false;
|
||||
var removeFailedDownloads = true;
|
||||
|
||||
using (var removeCompletedDownloadsCmd = conn.CreateCommand(tran, "SELECT Value FROM Config WHERE Key = 'removecompleteddownloads'"))
|
||||
{
|
||||
if ("False" == (removeCompletedDownloadsCmd.ExecuteScalar() as string))
|
||||
removeCompletedDownloads = false;
|
||||
if ("true" == (removeCompletedDownloadsCmd.ExecuteScalar() as string)?.ToLower())
|
||||
removeCompletedDownloads = true;
|
||||
}
|
||||
|
||||
using (var removeFailedDownloadsCmd = conn.CreateCommand(tran, "SELECT Value FROM Config WHERE Key = 'removefaileddownloads'"))
|
||||
{
|
||||
if ("True" == (removeFailedDownloadsCmd.ExecuteScalar() as string))
|
||||
removeFailedDownloads = true;
|
||||
if ("false" == (removeFailedDownloadsCmd.ExecuteScalar() as string)?.ToLower())
|
||||
removeFailedDownloads = false;
|
||||
}
|
||||
|
||||
using (var updateClientCmd = conn.CreateCommand(tran, $"UPDATE DownloadClients SET RemoveCompletedDownloads = (CASE WHEN Implementation IN (\"RTorrent\", \"Flood\") THEN 0 ELSE ? END), RemoveFailedDownloads = ?"))
|
||||
|
Loading…
Reference in New Issue
Block a user