fix(network): Not all Sonarr tasks return the lastDuration field and was causing a crash
This commit is contained in:
@@ -396,7 +396,6 @@ pub struct SonarrTask {
|
|||||||
#[serde(deserialize_with = "super::from_i64")]
|
#[serde(deserialize_with = "super::from_i64")]
|
||||||
pub interval: i64,
|
pub interval: i64,
|
||||||
pub last_execution: DateTime<Utc>,
|
pub last_execution: DateTime<Utc>,
|
||||||
pub last_duration: String,
|
|
||||||
pub next_execution: DateTime<Utc>,
|
pub next_execution: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3688,7 +3688,6 @@ mod test {
|
|||||||
"interval": 360,
|
"interval": 360,
|
||||||
"lastExecution": "2023-05-20T21:29:16Z",
|
"lastExecution": "2023-05-20T21:29:16Z",
|
||||||
"nextExecution": "2023-05-20T21:29:16Z",
|
"nextExecution": "2023-05-20T21:29:16Z",
|
||||||
"lastDuration": "00:00:00.5111547",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Backup",
|
"name": "Backup",
|
||||||
@@ -3696,7 +3695,6 @@ mod test {
|
|||||||
"interval": 10080,
|
"interval": 10080,
|
||||||
"lastExecution": "2023-05-20T21:29:16Z",
|
"lastExecution": "2023-05-20T21:29:16Z",
|
||||||
"nextExecution": "2023-05-20T21:29:16Z",
|
"nextExecution": "2023-05-20T21:29:16Z",
|
||||||
"lastDuration": "00:00:00.5111547",
|
|
||||||
}]);
|
}]);
|
||||||
let response: Vec<SonarrTask> = serde_json::from_value(tasks_json.clone()).unwrap();
|
let response: Vec<SonarrTask> = serde_json::from_value(tasks_json.clone()).unwrap();
|
||||||
let timestamp = DateTime::from(DateTime::parse_from_rfc3339("2023-05-20T21:29:16Z").unwrap());
|
let timestamp = DateTime::from(DateTime::parse_from_rfc3339("2023-05-20T21:29:16Z").unwrap());
|
||||||
@@ -3707,7 +3705,6 @@ mod test {
|
|||||||
interval: 360,
|
interval: 360,
|
||||||
last_execution: timestamp,
|
last_execution: timestamp,
|
||||||
next_execution: timestamp,
|
next_execution: timestamp,
|
||||||
last_duration: "00:00:00.5111547".to_owned(),
|
|
||||||
},
|
},
|
||||||
SonarrTask {
|
SonarrTask {
|
||||||
name: "Backup".to_owned(),
|
name: "Backup".to_owned(),
|
||||||
@@ -3715,7 +3712,6 @@ mod test {
|
|||||||
interval: 10080,
|
interval: 10080,
|
||||||
last_execution: timestamp,
|
last_execution: timestamp,
|
||||||
next_execution: timestamp,
|
next_execution: timestamp,
|
||||||
last_duration: "00:00:00.5111547".to_owned(),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let (async_server, app_arc, _server) = mock_servarr_api(
|
let (async_server, app_arc, _server) = mock_servarr_api(
|
||||||
|
|||||||
Reference in New Issue
Block a user