Skip to content

Commit

Permalink
change order
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnl committed Sep 6, 2023
1 parent 041f83b commit 3e765d1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions instructor/cli/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ def group_and_sum_by_date_and_snapshot(usage_data: List[dict]) -> Table:
table.add_column("Total Requests", justify="right")
table.add_column("Total Cost ($)", justify="right")

for date, snapshots in summary.items():
for snapshot_id, data in snapshots.items():
# Sort dates and snapshots in descending order
sorted_dates = sorted(summary.keys(), reverse=True)
for date in sorted_dates:
sorted_snapshots = sorted(summary[date].keys(), reverse=True)
for snapshot_id in sorted_snapshots:
data = summary[date][snapshot_id]
table.add_row(
date,
snapshot_id,
Expand Down

0 comments on commit 3e765d1

Please sign in to comment.