first cleanup iter
CI - Security, Lint & Tests / validate (push) Failing after 25m59s

This commit is contained in:
cedrick2711
2026-09-09 08:26:47 -04:00
parent 101e3ae880
commit e53bc3b80d
35 changed files with 2138 additions and 2187 deletions
+34
View File
@@ -29,6 +29,40 @@ from app.validators import EvaluationSchema
evaluations_bp = Blueprint('evaluations', __name__, url_prefix='/evaluations')
def validate_score(value):
"""Convert a raw form value to an int 1..10, or None if blank/invalid.
Args:
value: Raw value from request.form — a string, or None for a missing field.
Returns:
int | None: Score 1-10, or None.
"""
if value is None or (isinstance(value, str) and value.strip() == ''):
return None
try:
score = int(value)
except (ValueError, TypeError):
return None
if score < 1 or score > 10:
return None
return score
def _apply_evaluation(evaluation, scores, comments, position):
"""Write scores, comments and recommended position onto an Evaluation row.
Args:
evaluation: The Evaluation instance (new or existing).
scores: Dict mapping criterion name to int or None.
comments: Free-text comment string, or None.
position: Recommended position string, or None.
"""
evaluation.apply_scores(scores)
evaluation.comments = comments
evaluation.position_recommendation = position
def _users_by_id(user_ids):
"""Load a set of users once for aggregate/list views."""
wanted = {user_id for user_id in user_ids if user_id}