Fix error when caching zero results
This commit is contained in:
parent
d5dfb47aea
commit
5d9184df32
@ -57,6 +57,13 @@ pub async fn report(
|
||||
|
||||
async fn cache_report(db: &DatabaseConnection, models: &Vec<ReportEntry>) -> Result<()> {
|
||||
let models = models.iter().flat_map(|entry| entry.as_models());
|
||||
let models = models.collect::<Vec<_>>();
|
||||
debug!("Caching report entries: {:?}", models);
|
||||
|
||||
// TODO: Why is this needed?
|
||||
if models.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
TimeEntry::insert_many(models)
|
||||
.on_conflict(ReportEntry::grafting_conflict_statement())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user