diff --git a/api/judging/judging_service.py b/api/judging/judging_service.py index e6c0111..5f53a63 100644 --- a/api/judging/judging_service.py +++ b/api/judging/judging_service.py @@ -290,7 +290,7 @@ def submit_judge_score(judge_id: str, team_id: str, event_id: str, required_fields = ['scopeImpact', 'scopeComplexity', 'documentationCode', 'documentationEase', 'polishWorkRemaining', 'polishCanUseToday', - 'securityData', 'securityRole'] + 'securityData', 'securityRole'] # We don't include accessibility here as it's optional and a special category prize for field in required_fields: if field not in scores_data: @@ -492,10 +492,14 @@ def format_team_for_judge(team: Dict, score_lookup: Dict = None, nonprofit_id: s if github_links and len(github_links) > 0: github_url = github_links[0].get('link', '') + # Get score info for this team + score_key = f"{team_id}_round1" + score_obj = score_lookup.get(score_key) if score_key in score_lookup else None + return { "id": team_id, "name": team.get('name', ''), - "problem_statement": { + "problem_statement": { "nonprofit": nonprofit_name, "nonprofit_id": nonprofit_id }, @@ -505,9 +509,12 @@ def format_team_for_judge(team: Dict, score_lookup: Dict = None, nonprofit_id: s "slack_channel": team.get('slack_channel', ''), "video_url": team.get('video_url', ''), "demo_time": None, # Will be overridden for round2 - "judged": f"{team_id}_round1" in score_lookup, - "score": (score_lookup.get(f"{team_id}_round1").total_score - if f"{team_id}_round1" in score_lookup else None) + "judged": score_obj is not None, + "score": score_obj.total_score if score_obj else None, + "specialCategoryScores": + { + "accessibility": score_obj.accessibility if score_obj else None + } } diff --git a/api/teams/teams_service.py b/api/teams/teams_service.py index c3ae10a..490452e 100644 --- a/api/teams/teams_service.py +++ b/api/teams/teams_service.py @@ -276,6 +276,10 @@ def edit_team(json): "devpost_link": "devpost_link", } + # If this is the first time setting devpost_link, set devpost_link_submitted date + if "devpost_link" in json and "devpost_link" not in team_data: + update_data["devpost_link_submitted"] = datetime.now().isoformat() + for db_field, json_field in field_mappings.items(): if json_field in json: update_data[db_field] = json[json_field] diff --git a/model/judge_score.py b/model/judge_score.py index 71f1c6b..47725d4 100644 --- a/model/judge_score.py +++ b/model/judge_score.py @@ -16,6 +16,7 @@ def __init__(self): self.polish_can_use_today = None # 1-5 points self.security_data = None # 1-5 points self.security_role = None # 1-5 points + self.accessibility = None # 1-5 points self.total_score = None # Calculated from individual scores self.feedback = '' # Optional feedback from judge self.is_draft = False @@ -39,6 +40,7 @@ def deserialize(cls, d): score.polish_can_use_today = d.get('polish_can_use_today') score.security_data = d.get('security_data') score.security_role = d.get('security_role') + score.accessibility = d.get('accessibility') score.total_score = d.get('total_score') score.is_draft = d.get('is_draft', False) score.feedback = d.get('feedback', '') @@ -46,7 +48,7 @@ def deserialize(cls, d): score.created_at = d.get('created_at') score.updated_at = d.get('updated_at') return score - + def serialize(self): d = {} props = dir(self) @@ -58,7 +60,8 @@ def serialize(self): return d def calculate_total_score(self): - """Calculate total score from individual criteria scores""" + """Calculate total score from individual criteria scores. + Note: accessibility is excluded as it's a special category prize.""" scores = [ self.scope_impact, self.scope_complexity, @@ -68,12 +71,13 @@ def calculate_total_score(self): self.polish_can_use_today, self.security_data, self.security_role + # accessibility is intentionally excluded from total score ] - - # Only calculate if all scores are present + + # Only calculate if all required scores are present if all(score is not None for score in scores): self.total_score = sum(scores) - + return self.total_score def to_api_format(self): @@ -87,6 +91,7 @@ def to_api_format(self): "polishCanUseToday": self.polish_can_use_today, "securityData": self.security_data, "securityRole": self.security_role, + "accessibility": self.accessibility, "total": self.total_score } @@ -102,8 +107,11 @@ def from_api_format(cls, api_scores): score.polish_can_use_today = api_scores.get('polishCanUseToday') score.security_data = api_scores.get('securityData') score.security_role = api_scores.get('securityRole') + score.accessibility = api_scores.get('accessibility') score.total_score = api_scores.get('total') return score def __str__(self): - return f"JudgeScore(id={self.id}, judge_id={self.judge_id}, team_id={self.team_id}, event_id={self.event_id}, round={self.round}, total={self.total_score})" \ No newline at end of file + return (f"JudgeScore(id={self.id}, judge_id={self.judge_id}, " + f"team_id={self.team_id}, event_id={self.event_id}, " + f"round={self.round}, total={self.total_score})")