|
|
@ -28,6 +28,7 @@ class Community: |
|
|
|
default_factory=list) # (user_id_1, user_id_2, meeting date) |
|
|
|
default_factory=list) # (user_id_1, user_id_2, meeting date) |
|
|
|
archived_meetings: typing.List[typing.Tuple[int, int, date]] = field(default_factory=list) |
|
|
|
archived_meetings: typing.List[typing.Tuple[int, int, date]] = field(default_factory=list) |
|
|
|
default_answers: typing.Dict[int, bool] = field(default_factory=dict) # Last answers |
|
|
|
default_answers: typing.Dict[int, bool] = field(default_factory=dict) # Last answers |
|
|
|
|
|
|
|
task_last_timestamps: typing.Dict[str, date] = field(default_factory=dict) # {'poll': ..., 'scheduling': ...} |
|
|
|
start_timestamp: int = field(default_factory=lambda: int(time.time())) |
|
|
|
start_timestamp: int = field(default_factory=lambda: int(time.time())) |
|
|
|
|
|
|
|
|
|
|
|
def dict(self) -> dict: |
|
|
|
def dict(self) -> dict: |
|
|
@ -36,6 +37,8 @@ class Community: |
|
|
|
data['default_answers'] = {str(k): self.default_answers[k] for k in self.default_answers} |
|
|
|
data['default_answers'] = {str(k): self.default_answers[k] for k in self.default_answers} |
|
|
|
data['scheduled_meetings'] = [(l, m, r.toordinal()) for l, m, r in self.scheduled_meetings] |
|
|
|
data['scheduled_meetings'] = [(l, m, r.toordinal()) for l, m, r in self.scheduled_meetings] |
|
|
|
data['archived_meetings'] = [(l, m, r.toordinal()) for l, m, r in self.archived_meetings] |
|
|
|
data['archived_meetings'] = [(l, m, r.toordinal()) for l, m, r in self.archived_meetings] |
|
|
|
|
|
|
|
data['task_last_timestamps'] = {str(k): self.task_last_timestamps[k].toordinal() for k in |
|
|
|
|
|
|
|
self.task_last_timestamps} |
|
|
|
return data |
|
|
|
return data |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@classmethod |
|
|
@ -47,6 +50,8 @@ class Community: |
|
|
|
self = cls(**data_) |
|
|
|
self = cls(**data_) |
|
|
|
self.polled = {int(k): convert_to_date(self.polled[k]) for k in self.polled} |
|
|
|
self.polled = {int(k): convert_to_date(self.polled[k]) for k in self.polled} |
|
|
|
self.default_answers = {int(k): self.default_answers[k] for k in self.default_answers} |
|
|
|
self.default_answers = {int(k): self.default_answers[k] for k in self.default_answers} |
|
|
|
|
|
|
|
self.task_last_timestamps = {k: convert_to_date(self.task_last_timestamps[k]) for k in |
|
|
|
|
|
|
|
self.task_last_timestamps} |
|
|
|
self.scheduled_meetings = [(int(l), int(m), convert_to_date(r)) for l, m, r in self.scheduled_meetings] |
|
|
|
self.scheduled_meetings = [(int(l), int(m), convert_to_date(r)) for l, m, r in self.scheduled_meetings] |
|
|
|
self.archived_meetings = [(int(l), int(m), convert_to_date(r)) for l, m, r in self.archived_meetings] |
|
|
|
self.archived_meetings = [(int(l), int(m), convert_to_date(r)) for l, m, r in self.archived_meetings] |
|
|
|
return self |
|
|
|
return self |
|
|
|