fix empty array error

This commit is contained in:
mcbloch 2023-12-07 17:47:28 +01:00
parent 9af648f305
commit 8c50ac5550
1 changed files with 3 additions and 1 deletions

View File

@ -133,8 +133,10 @@ fn get_ppu() !f64 {
mut people := sql db {
select from Person where status == 3
}!
if people.len == 0 {
return 0
}
people.sort(a.order_time < b.order_time)
time_range := people.last().order_time - people.first().order_time
return people.len / time_range.hours()
}