Skip to content

Commit

Permalink
Fix a flaw in award verification.
Browse files Browse the repository at this point in the history
It's possible for an award to be assigned to a character without actually generating any character record data if a maxed-out player makes a new character and receives Traveling Bonus CP instead of Event CP.
  • Loading branch information
kw committed Apr 24, 2024
1 parent 81fd947 commit 0ed8d77
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/camp/engine/rules/tempest/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,11 @@ def validate_last_event_date(self):

@model_validator(mode="after")
def validate_character_records(self):
"""A character record exists for every character mentioned in an award."""
"""A character is mentioned for every award that needs one."""
for a in self.awards or []:
if (
a.needs_character
and a.character is not None
and a.character not in self.characters
):
if a.needs_character and a.character is None:
raise ValueError(
f"Character record for {a.character} not properly initialized."
f"Award record not properly initialized (needs a character): {a}"
)
return self

Expand Down

0 comments on commit 0ed8d77

Please sign in to comment.