| from typing import List |
| from models import RevOpsAction, LeadData |
|
|
| def grader_easy(actions: List[RevOpsAction], leads: List[LeadData]) -> float: |
| |
| score = 0.0 |
| enriched = any(a.action_type == "enrich_lead" for a in actions) |
| scored = any(a.action_type == "update_lead_score" and 60 <= (a.score or 0) <= 90 for a in actions) |
| routed_correctly = any(a.action_type == "route_to_rep" and a.rep_id == "rep_amer_mm" for a in actions) |
| |
| if enriched: score += 0.2 |
| if scored: score += 0.3 |
| if routed_correctly: score += 0.5 |
| |
| return score |
|
|
| def grader_medium(actions: List[RevOpsAction], leads: List[LeadData]) -> float: |
| |
| score = 0.0 |
| enriched_first = False |
| |
| scored_val = None |
| routed_rep = None |
| |
| has_enriched = False |
| for a in actions: |
| if a.action_type == "enrich_lead": |
| has_enriched = True |
| if a.action_type == "update_lead_score": |
| scored_val = a.score |
| if has_enriched: |
| enriched_first = True |
| if a.action_type == "route_to_rep": |
| routed_rep = a.rep_id |
|
|
| if has_enriched: score += 0.2 |
| if enriched_first and scored_val is not None and scored_val >= 80: score += 0.4 |
| if routed_rep == "rep_emea_ent": score += 0.4 |
| |
| return score |
|
|
| def grader_hard(actions: List[RevOpsAction], leads: List[LeadData]) -> float: |
| |
| score = 0.0 |
| |
| disqualified_count = sum(1 for a in actions if a.action_type == "disqualify") |
| if disqualified_count >= 2: |
| score += 0.2 |
| |
| checked_crm = any(a.action_type == "check_crm" for a in actions) |
| merged = any(a.action_type == "merge_with_account" and a.account_id == "acc_major_fin" for a in actions) |
| flagged = any(a.action_type == "flag_reengagement" and a.opportunity_id == "opp_101" for a in actions) |
| routed = any(a.action_type == "route_to_rep" and a.rep_id == "rep_amer_ent_original" for a in actions) |
| |
| if checked_crm: score += 0.1 |
| if merged: score += 0.2 |
| if flagged: score += 0.2 |
| if routed: score += 0.3 |
| |
| |
| routed_wrong = any(a.action_type == "route_to_rep" and a.rep_id != "rep_amer_ent_original" for a in actions) |
| if not checked_crm and routed_wrong: |
| return 0.0 |
| |
| return score |
|
|