Skip to content

Commit df4b087

Browse files
committed
if else
1 parent b152c25 commit df4b087

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

elementary/monitor/api/tests/tests.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ def get_test_results_summary(
7373
dbt_invocation: Optional[DbtInvocationSchema] = None,
7474
) -> List[TestResultSummarySchema]:
7575
filtered_test_results_db_rows = self.test_results_db_rows
76-
if dbt_invocation and dbt_invocation.invocation_id:
77-
filtered_test_results_db_rows = [
78-
test_result
79-
for test_result in filtered_test_results_db_rows
80-
if test_result.invocation_id == dbt_invocation.invocation_id
81-
]
8276
if filter.tag:
8377
filtered_test_results_db_rows = [
8478
test_result
@@ -101,11 +95,19 @@ def get_test_results_summary(
10195
)
10296
]
10397

104-
filtered_test_results_db_rows = [
105-
test_result
106-
for test_result in filtered_test_results_db_rows
107-
if test_result.invocations_rank_index == 1
108-
]
98+
if dbt_invocation and dbt_invocation.invocation_id:
99+
filtered_test_results_db_rows = [
100+
test_result
101+
for test_result in filtered_test_results_db_rows
102+
if test_result.invocation_id == dbt_invocation.invocation_id
103+
]
104+
else:
105+
filtered_test_results_db_rows = [
106+
test_result
107+
for test_result in filtered_test_results_db_rows
108+
if test_result.invocations_rank_index == 1
109+
]
110+
109111
return [
110112
TestResultSummarySchema(
111113
test_unique_id=test_result.test_unique_id,

0 commit comments

Comments
 (0)