From 9403bdcbcbd47d4f7ab68f0d6329cbf1ab81de7f Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Fri, 22 Nov 2024 17:10:06 -0700 Subject: [PATCH] fix(network): Not all Sonarr tasks return the lastDuration field and was causing a crash --- src/models/sonarr_models.rs | 1 - src/network/sonarr_network_tests.rs | 4 ---- 2 files changed, 5 deletions(-) diff --git a/src/models/sonarr_models.rs b/src/models/sonarr_models.rs index a891eaa..8973709 100644 --- a/src/models/sonarr_models.rs +++ b/src/models/sonarr_models.rs @@ -396,7 +396,6 @@ pub struct SonarrTask { #[serde(deserialize_with = "super::from_i64")] pub interval: i64, pub last_execution: DateTime, - pub last_duration: String, pub next_execution: DateTime, } diff --git a/src/network/sonarr_network_tests.rs b/src/network/sonarr_network_tests.rs index 39dfccf..d247564 100644 --- a/src/network/sonarr_network_tests.rs +++ b/src/network/sonarr_network_tests.rs @@ -3688,7 +3688,6 @@ mod test { "interval": 360, "lastExecution": "2023-05-20T21:29:16Z", "nextExecution": "2023-05-20T21:29:16Z", - "lastDuration": "00:00:00.5111547", }, { "name": "Backup", @@ -3696,7 +3695,6 @@ mod test { "interval": 10080, "lastExecution": "2023-05-20T21:29:16Z", "nextExecution": "2023-05-20T21:29:16Z", - "lastDuration": "00:00:00.5111547", }]); let response: Vec = serde_json::from_value(tasks_json.clone()).unwrap(); let timestamp = DateTime::from(DateTime::parse_from_rfc3339("2023-05-20T21:29:16Z").unwrap()); @@ -3707,7 +3705,6 @@ mod test { interval: 360, last_execution: timestamp, next_execution: timestamp, - last_duration: "00:00:00.5111547".to_owned(), }, SonarrTask { name: "Backup".to_owned(), @@ -3715,7 +3712,6 @@ mod test { interval: 10080, last_execution: timestamp, next_execution: timestamp, - last_duration: "00:00:00.5111547".to_owned(), }, ]; let (async_server, app_arc, _server) = mock_servarr_api(