feat(http): task view indexed and deleted documents return 0 instead of null

This commit is contained in:
Marin Postma 2022-01-06 13:18:47 +01:00
parent 0d2a358cc2
commit f558ff826a

View File

@ -215,6 +215,27 @@ impl From<Task> for TaskView {
(TaskStatus::Succeeded, None, Some(*timestamp))
}
TaskEvent::Failed { timestamp, error } => {
match details {
Some(TaskDetails::DocumentDeletion {
ref mut deleted_documents,
..
}) => {
deleted_documents.replace(0);
}
Some(TaskDetails::ClearAll {
ref mut deleted_documents,
..
}) => {
deleted_documents.replace(0);
}
Some(TaskDetails::DocumentAddition {
ref mut indexed_documents,
..
}) => {
indexed_documents.replace(0);
}
_ => (),
}
(TaskStatus::Failed, Some(error.clone()), Some(*timestamp))
}
};