feat(reports): sort exported breakdown tables
This commit is contained in:
@@ -7,6 +7,7 @@ from apps.reports.services.export_i18n import build_export_locale
|
||||
from apps.reports.services.exporters import (
|
||||
_pdf_summary_rate_label,
|
||||
_rate_label,
|
||||
_sort_breakdown_rows,
|
||||
build_excel_report,
|
||||
build_pdf_report,
|
||||
)
|
||||
@@ -133,6 +134,23 @@ class ReportExporterTests(TestCase):
|
||||
"Variable rate",
|
||||
)
|
||||
|
||||
def test_breakdown_rows_are_sorted_by_hour_percentage(self):
|
||||
rows = [
|
||||
{"id": "low", "name": "Low", "billable_seconds": 7200},
|
||||
{"id": "high", "name": "High", "billable_seconds": 3600},
|
||||
{"id": "tie", "name": "Tie", "billable_seconds": 10800},
|
||||
]
|
||||
percentages = [
|
||||
{"id": "low", "name": "Low", "percentage": "20"},
|
||||
{"id": "high", "name": "High", "percentage": "70"},
|
||||
{"id": "tie", "name": "Tie", "percentage": "20"},
|
||||
]
|
||||
|
||||
self.assertEqual(
|
||||
[row["name"] for row in _sort_breakdown_rows(rows, percentages)],
|
||||
["High", "Tie", "Low"],
|
||||
)
|
||||
|
||||
def test_excel_export_adds_per_user_sheets_and_daily_rate_column(self):
|
||||
locale = build_export_locale("en")
|
||||
report_data = make_report_data(
|
||||
|
||||
Reference in New Issue
Block a user