37 lines
1 KiB
Python
37 lines
1 KiB
Python
|
|
from datetime import date
|
||
|
|
|
||
|
|
unions = ['D', 'M', 'L'] # Divorce (0), Mariage ou Pacs (1), Union Libre (2)
|
||
|
|
|
||
|
|
|
||
|
|
class Mariage:
|
||
|
|
def __init__(self, uid: int, id_a: int, id_b: int, event_date: date, last_mariage: bool,
|
||
|
|
hide: bool, union: str):
|
||
|
|
self._uid = uid
|
||
|
|
self._id_a = id_a
|
||
|
|
self._id_b = id_b
|
||
|
|
self._date = event_date
|
||
|
|
self._last_mariage = last_mariage
|
||
|
|
self._hide = hide
|
||
|
|
if union not in unions:
|
||
|
|
raise ValueError('{} is not in {}'.format(union, unions))
|
||
|
|
self._union = union
|
||
|
|
|
||
|
|
def show_mariage(self):
|
||
|
|
return not self._hide and self._union != 'D' and self._last_mariage
|
||
|
|
|
||
|
|
def event_date(self):
|
||
|
|
return self._date
|
||
|
|
|
||
|
|
def in_this_union(self, uid: int) -> bool:
|
||
|
|
return self._id_a == uid or self._id_b == uid
|
||
|
|
|
||
|
|
def get_so(self, uid: int) -> int:
|
||
|
|
if uid == self._id_a:
|
||
|
|
return self._id_b
|
||
|
|
return self._id_a
|
||
|
|
|
||
|
|
def id_a(self):
|
||
|
|
return self._id_a
|
||
|
|
|
||
|
|
def id_b(self):
|
||
|
|
return self._id_b
|