Skip to content

Commit 7fa1d3e

Browse files
Inline cadmin project score map
1 parent cd52c33 commit 7fa1d3e

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

cadmin/views/project_submission_edit.py

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

5454

55-
def project_evaluation_score_map(submission):
55+
def criteria_with_project_scores(review_criteria, submission):
56+
evaluation_scores = {}
5657
scores = ProjectEvaluationScore.objects.filter(submission=submission)
57-
score_map = {}
5858
for score in scores:
59-
score_map[score.review_criteria_id] = score
60-
return score_map
61-
59+
evaluation_scores[score.review_criteria_id] = score
6260

63-
def criteria_with_project_scores(review_criteria, submission):
64-
evaluation_scores = project_evaluation_score_map(submission)
6561
criteria_scores = []
6662
for criteria in review_criteria:
6763
evaluation_score = evaluation_scores.get(criteria.id)

docs/refactoring-plan.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5154,6 +5154,20 @@ Steps:
51545154
`wide_positional_calls=0`, `wide_function_args=0`,
51555155
`nested_wide_for_unpacking=0`, `range_len_loops=0`), and
51565156
`git diff --check`.
5157+
- [x] 2026-07-02: Removed the single-use cadmin project edit evaluation-score
5158+
map helper. `criteria_with_project_scores` now builds the score map directly
5159+
from the submission before assembling per-criteria score records.
5160+
Verification:
5161+
`uv run ruff check cadmin/views/project_submission_edit.py docs/refactoring-plan.md`,
5162+
`python -m py_compile cadmin/views/project_submission_edit.py`,
5163+
`uv run python manage.py test cadmin.tests.test_project_submission_edit_views`,
5164+
removed-helper reference scan, touched-function line-threshold scan,
5165+
`uvx pyrefly check`, repository AST cleanup scan excluding migrations
5166+
(`forbidden_comprehensions=0`, `threshold_violations=0`,
5167+
`append_constructed=0`, `wide_tuple_unpacking=0`,
5168+
`wide_positional_calls=0`, `wide_function_args=0`,
5169+
`nested_wide_for_unpacking=0`, `range_len_loops=0`), and
5170+
`git diff --check`.
51575171
- [x] 2026-07-02: Removed the single-use timezone preference save helper. The
51585172
timezone update view now assigns and saves `user.preferred_timezone` directly
51595173
in the successful update branch, while validation and response helpers remain

0 commit comments

Comments
 (0)