fix re-enable token on closed camapign + refacto war_event attributes
This commit is contained in:
parent
5c124f9229
commit
6efd22527a
8 changed files with 108 additions and 57 deletions
|
|
@ -63,19 +63,32 @@ class WarEvent:
|
|||
class TieResolved(WarEvent):
|
||||
TYPE = "TieResolved"
|
||||
|
||||
def __init__(self, participant_id: str | None, context_type: str, context_id: str):
|
||||
def __init__(
|
||||
self,
|
||||
participant_id: str | None,
|
||||
context_type: str,
|
||||
context_id: str,
|
||||
score_value: int | None = None,
|
||||
):
|
||||
super().__init__(participant_id, context_type, context_id)
|
||||
self.score_value = score_value
|
||||
|
||||
def toDict(self) -> Dict[str, Any]:
|
||||
d = super().toDict()
|
||||
d.update(
|
||||
{
|
||||
"score_value": self.score_value or None,
|
||||
}
|
||||
)
|
||||
return d
|
||||
|
||||
@classmethod
|
||||
def fromDict(cls, data: Dict[str, Any]) -> TieResolved:
|
||||
ev = cls(
|
||||
data["participant_id"],
|
||||
data["participant_id"] or None,
|
||||
data["context_type"],
|
||||
data["context_id"],
|
||||
data["score_value"] or None,
|
||||
)
|
||||
return cls._base_fromDict(ev, data)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue