fix empty array error
This commit is contained in:
parent
9af648f305
commit
8c50ac5550
1 changed files with 3 additions and 1 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue