Skip to content

Commit

Permalink
feat: make hardwareDetails endpoint use only the tree heads
Browse files Browse the repository at this point in the history
Close #527
  • Loading branch information
lfjnascimento committed Nov 19, 2024
1 parent 374c2bf commit b9193cc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/kernelCI_app/views/hardwareDetailsView.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ def generate_test_dict():
}


def is_record_in_tree_head(record, tree):
return record["checkout_git_commit_hash"] == tree["headGitCommitHash"]


# disable django csrf protection https://docs.djangoproject.com/en/5.0/ref/csrf/
# that protection is recommended for ‘unsafe’ methods (POST, PUT, and DELETE)
# but we are using POST here just to follow the convention to use the request body
Expand All @@ -137,7 +141,7 @@ def sanitize_records(self, records, selected_trees):

for r in records:
current_tree = get_current_selected_tree(r, selected_trees)
if not current_tree:
if not current_tree or not is_record_in_tree_head(r, current_tree):
continue

build_id = r["build_id"]
Expand Down

0 comments on commit b9193cc

Please sign in to comment.