Skip to content

Commit cd52c33

Browse files
Inline cadmin project criteria query
1 parent b2fa242 commit cd52c33

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

cadmin/views/project_submission_edit.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ def project_submission_edit_objects(
5252
)
5353

5454

55-
def project_review_criteria(course):
56-
criteria = ReviewCriteria.objects.filter(course=course)
57-
ordered_criteria = criteria.order_by("id")
58-
return ordered_criteria
59-
60-
6155
def project_evaluation_score_map(submission):
6256
scores = ProjectEvaluationScore.objects.filter(submission=submission)
6357
score_map = {}
@@ -115,7 +109,8 @@ def handle_project_submission_edit_post(data):
115109

116110

117111
def project_submission_edit_page_data(request, edit_objects):
118-
review_criteria = project_review_criteria(edit_objects.course)
112+
criteria = ReviewCriteria.objects.filter(course=edit_objects.course)
113+
review_criteria = criteria.order_by("id")
119114
criteria_with_scores = criteria_with_project_scores(
120115
review_criteria,
121116
edit_objects.submission,

docs/refactoring-plan.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5141,6 +5141,19 @@ Steps:
51415141
`wide_positional_calls=0`, `wide_function_args=0`,
51425142
`nested_wide_for_unpacking=0`, `range_len_loops=0`), and
51435143
`git diff --check`.
5144+
- [x] 2026-07-02: Removed the single-use cadmin project edit review-criteria
5145+
queryset helper. The page-data builder now names the filtered criteria
5146+
queryset and ordering directly before attaching project scores. Verification:
5147+
`uv run ruff check cadmin/views/project_submission_edit.py docs/refactoring-plan.md`,
5148+
`python -m py_compile cadmin/views/project_submission_edit.py`,
5149+
`uv run python manage.py test cadmin.tests.test_project_submission_edit_views`,
5150+
removed-helper reference scan, touched-function line-threshold scan,
5151+
`uvx pyrefly check`, repository AST cleanup scan excluding migrations
5152+
(`forbidden_comprehensions=0`, `threshold_violations=0`,
5153+
`append_constructed=0`, `wide_tuple_unpacking=0`,
5154+
`wide_positional_calls=0`, `wide_function_args=0`,
5155+
`nested_wide_for_unpacking=0`, `range_len_loops=0`), and
5156+
`git diff --check`.
51445157
- [x] 2026-07-02: Removed the single-use timezone preference save helper. The
51455158
timezone update view now assigns and saves `user.preferred_timezone` directly
51465159
in the successful update branch, while validation and response helpers remain

0 commit comments

Comments
 (0)