Skip to content

Commit ce41872

Browse files
[#2466223] Resolve metrics bug
1 parent ce1f602 commit ce41872

File tree

1 file changed

+3
-2
lines changed
  • components/resc-backend/src/resc_backend/resc_web_service/endpoints

1 file changed

+3
-2
lines changed

components/resc-backend/src/resc_backend/resc_web_service/endpoints/metrics.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,9 @@ def get_audit_count_by_auditor_over_time(db_connection: Session = Depends(get_db
187187
# set the counts based on the data from the database
188188
for audit in audit_counts:
189189
audit_week = f"{audit['year']} W{audit['week']:02d}"
190-
weekly_audit_counts.get(audit_week).audit_by_auditor_count[audit['auditor']] = audit['audit_count']
191-
weekly_audit_counts.get(audit_week).total += audit['audit_count']
190+
if audit_week in weekly_audit_counts:
191+
weekly_audit_counts.get(audit_week).audit_by_auditor_count[audit['auditor']] = audit['audit_count']
192+
weekly_audit_counts.get(audit_week).total += audit['audit_count']
192193

193194
sorted_weekly_audit_counts = dict(sorted(weekly_audit_counts.items()))
194195
output = list(sorted_weekly_audit_counts.values())

0 commit comments

Comments
 (0)