Skip to content

Commit

Permalink
fix(tree-listing): update serializers and type
Browse files Browse the repository at this point in the history
Removed total counts from TreeSerializer and TreeView that were not being used
handling. Added null_boots count to TreeView. # Please enter the commit message for your changes. Lines starting

Part of #833
  • Loading branch information
WilsonNet committed Jan 31, 2025
1 parent 234fa17 commit 560356e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 39 deletions.
3 changes: 1 addition & 2 deletions backend/kernelCI_app/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def get_build_status(self, obj) -> Dict:
"valid": obj.valid_builds,
"invalid": obj.invalid_builds,
"null": obj.null_builds,
"total": obj.total_builds
}

def get_test_status(self, obj) -> Dict:
Expand All @@ -51,7 +50,6 @@ def get_test_status(self, obj) -> Dict:
"done": obj.done_tests,
"skip": obj.skip_tests,
"null": obj.null_tests,
"total": obj.total_tests
}

def get_boot_status(self, obj) -> Dict:
Expand All @@ -62,6 +60,7 @@ def get_boot_status(self, obj) -> Dict:
"pass": obj.pass_boots,
"done": obj.done_boots,
"skip": obj.skip_boots,
"null": obj.null_boots,
}


Expand Down
4 changes: 2 additions & 2 deletions backend/kernelCI_app/views/treeView.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def get(self, request):
COUNT(DISTINCT CASE WHEN builds.valid = false THEN builds.id END) AS invalid_builds,
COUNT(DISTINCT CASE WHEN builds.valid IS NULL AND builds.id IS NOT NULL THEN builds.id END)
AS null_builds,
COUNT(DISTINCT builds.id) AS total_builds,
COUNT(CASE WHEN (tests.path <> 'boot' AND tests.path NOT LIKE 'boot.%%')
AND tests.status = 'FAIL' THEN 1 END) AS fail_tests,
COUNT(CASE WHEN (tests.path <> 'boot' AND tests.path NOT LIKE 'boot.%%')
Expand All @@ -76,7 +75,6 @@ def get(self, request):
AND tests.status = 'SKIP' THEN 1 END) AS skip_tests,
SUM(CASE WHEN tests.status IS NULL AND tests.id IS NOT NULL THEN 1 ELSE 0 END)
AS null_tests,
COUNT(tests.id) AS total_tests,
COUNT(CASE WHEN (tests.path = 'boot' OR tests.path LIKE 'boot.%%')
AND tests.status = 'FAIL' THEN 1 END) AS fail_boots,
Expand All @@ -90,6 +88,8 @@ def get(self, request):
AND tests.status = 'DONE' THEN 1 END) AS done_boots,
COUNT(CASE WHEN (tests.path = 'boot' OR tests.path LIKE 'boot.%%')
AND tests.status = 'SKIP' THEN 1 END) AS skip_boots,
COUNT(CASE WHEN (tests.path = 'boot' OR tests.path LIKE 'boot.%%')
AND tests.status IS NULL AND tests.id IS NOT NULL THEN 1 ELSE 0 END) AS null_boots,
COALESCE(
ARRAY_AGG(DISTINCT tree_name) FILTER (
WHERE tree_name IS NOT NULL
Expand Down
49 changes: 14 additions & 35 deletions dashboard/src/types/tree/Tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,25 @@ export type TreeFastPathResponse = Array<{
start_time: string;
}>;

export type TableTestStatus = {
done: number;
pass: number;
error: number;
fail: number;
skip: number;
miss: number;
null: number;
};

export type TreeTableBody = {
commitHash: string;
commitName: string;
commitTag?: string[];
patchsetHash: string;
buildStatus?: BuildStatus;
tree_name?: string | null;
testStatus?: {
done: number;
pass: number;
error: number;
fail: number;
skip: number;
miss: number;
};
bootStatus?: {
done: number;
pass: number;
error: number;
fail: number;
skip: number;
miss: number;
};
testStatus?: TableTestStatus;
bootStatus?: TableTestStatus;
id: string;
branch: string;
date: string;
Expand All @@ -54,26 +50,9 @@ export type Tree = {
valid: number;
invalid: number;
null: number;
total: number;
};
test_status: {
fail: number;
error: number;
miss: number;
pass: number;
done: number;
skip: number;
null: number;
total: number;
};
boot_status: {
done: number;
pass: number;
error: number;
fail: number;
skip: number;
miss: number;
};
test_status: TableTestStatus;
boot_status: TableTestStatus;
};

export type TreeLatestResponse = {
Expand Down

0 comments on commit 560356e

Please sign in to comment.