Quickly get and return daily or hourly records
(job, interval)
| 393 | |
| 394 | |
| 395 | def get_record(job, interval): |
| 396 | """Quickly get and return daily or hourly records""" |
| 397 | try: |
| 398 | if interval == "hourly": |
| 399 | record = records[today][this_hour][job] |
| 400 | |
| 401 | elif interval == "daily": |
| 402 | record = sum(i[1][job] for i in list(records[today].items())) |
| 403 | |
| 404 | except KeyError: |
| 405 | # record does not yet exist |
| 406 | record = 0 |
| 407 | |
| 408 | return record |
| 409 | |
| 410 | |
| 411 | def update_record(job): |