Update the corresponding record stored in the global Storage class
(job)
| 409 | |
| 410 | |
| 411 | def update_record(job): |
| 412 | """Update the corresponding record stored in the global Storage class""" |
| 413 | # the order of the 2 conditional statements below is crucial |
| 414 | if today not in records.keys(): |
| 415 | records.update({today: {this_hour: {}}}) |
| 416 | |
| 417 | elif this_hour not in records[today].keys(): |
| 418 | records[today].update({this_hour: {}}) |
| 419 | |
| 420 | # get live record |
| 421 | live_rec = records[today][this_hour].get(job, 0) + 1 |
| 422 | |
| 423 | # update records |
| 424 | records[today][this_hour].update({job: live_rec}) |