Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions elementary/monitor/api/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,11 @@ def _get_invocations(
for elementary_unique_id, invocations in grouped_invocations.items():
totals = self._get_test_invocations_totals(invocations)
test_invocations[elementary_unique_id] = InvocationsSchema(
fail_rate=round((totals.errors + totals.failures) / len(invocations), 2)
if invocations
else 0,
fail_rate=(
round((totals.errors + totals.failures) / len(invocations), 2)
if invocations
else 0
),
totals=totals,
invocations=invocations,
description=self._get_invocations_description(totals),
Expand Down Expand Up @@ -426,15 +428,17 @@ def _parse_test_db_row(cls, test_db_row: TestDBRowSchema) -> TestSchema:
test_db_row.package_name, test_db_row.original_path
),
created_at=test_db_row.created_at if test_db_row.created_at else None,
latest_run_time=latest_run_datetime.isoformat()
if latest_run_datetime
else None,
latest_run_time_utc=latest_run_datetime.astimezone(tz.tzlocal()).isoformat()
if latest_run_datetime
else None,
latest_run_status=test_db_row.latest_run_status
if test_db_row.latest_run_status
else None,
latest_run_time=(
latest_run_datetime.astimezone(tz.tzlocal()).isoformat()
if latest_run_datetime
else None
),
latest_run_time_utc=(
latest_run_datetime.isoformat() if latest_run_datetime else None
),
latest_run_status=(
test_db_row.latest_run_status if test_db_row.latest_run_status else None
),
)

@staticmethod
Expand Down
Loading