Skip to content

Commit

Permalink
[Track-305-2] AS fix order number in report (#2477)
Browse files Browse the repository at this point in the history
  • Loading branch information
tolkamps1 authored Dec 11, 2024
1 parent 31a670a commit 0f9d016
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions epictrack-api/src/api/reports/report_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def _format_data(self, data, report_title=None):
else:
obj[k] = item[k]
if self.group_by:
obj["sl_no"] = len(formatted_data[obj.get(self.group_by, -1)]) + 1
formatted_data[obj.get(self.group_by, -1)].append(obj)
else:
formatted_data.append(obj)
Expand All @@ -66,7 +65,6 @@ def _format_data(self, data, report_title=None):
k: getattr(item, k) for k in self.data_keys if k not in excluded_items
}
if self.group_by:
obj["sl_no"] = len(formatted_data[obj.get(self.group_by, -1)]) + 1
formatted_data[obj.get(self.group_by, -1)].append(obj)
else:
formatted_data.append(obj)
Expand All @@ -78,6 +76,8 @@ def _format_data(self, data, report_title=None):
items,
key=lambda x: x[self.item_sort_key]
)
for index, item in enumerate(formatted_data[group], start=1):
item['sl_no'] = index
# Sort groups
if self.group_sort_order:
formatted_data = dict(
Expand Down

0 comments on commit 0f9d016

Please sign in to comment.