fix empty array error

This commit is contained in:
mcbloch 2023-12-07 17:47:28 +01:00
parent 9af648f305
commit 8c50ac5550

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()
}