Skip to content

Commit

Permalink
[history]: summarizer fails when there are no records for period
Browse files Browse the repository at this point in the history
 problem: date is only calculated when there are matching records for period
          when there are no matching records, there is no date and sorting fails
solution: check if date exists before accessing during sort
  • Loading branch information
Jaguar0625 committed May 20, 2024
1 parent 634e58c commit 8826e7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion history/summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def save(self, filename):
csv_writer = csv.DictWriter(outfile, field_names)
csv_writer.writerow(dict(zip(field_names, field_names)))

for row in sorted(self.rows, key=lambda row: row['date']):
for row in sorted(self.rows, key=lambda row: (row['date'] is not None, row['date'])):
csv_writer.writerow(row)


Expand Down

0 comments on commit 8826e7a

Please sign in to comment.