removed a comment. Notification types in the User's schema will remain booleans (email, whatsapp, signal, popup). Daniel clarified that some time ago.
This commit is contained in:
parent
09f6f247a1
commit
ad1e0249d7
@ -507,10 +507,10 @@ class User:
|
||||
user_phone: str
|
||||
password_hash: str
|
||||
api_key: str
|
||||
notify_email: bool # #TODO_clarify: should we use an IntFlag for multi-assignment?
|
||||
notify_whatsapp: bool # #TODO_clarify: should we use an IntFlag for multi-assignment?
|
||||
notify_signal: bool # #TODO_clarify: should we use an IntFlag for multi-assignment?
|
||||
notify_popup: bool # #TODO_clarify: should we use an IntFlag for multi-assignment?
|
||||
notify_email: bool
|
||||
notify_whatsapp: bool
|
||||
notify_signal: bool
|
||||
notify_popup: bool
|
||||
created: datetime
|
||||
modified: datetime
|
||||
|
||||
|
||||
@ -76,8 +76,17 @@ class TimeLogic():
|
||||
minute_delta = delta / np.timedelta64(1, unit)
|
||||
return minute_delta
|
||||
|
||||
def time_delta_from_now_to_tgt(self, tgt_time, unit="m"):
|
||||
def time_delta_from_now_to_tgt(self, tgt_time, unit="m", now_time=None):
|
||||
"""
|
||||
This method computes the timedelta between a target time {tgt_time} and the current timestamp. For the purpose of
|
||||
reproducibility and testing, the current timestamp {now_time} can be overwritten. The default behaviour uses the
|
||||
datetime.now() function.
|
||||
"""
|
||||
if now_time is None:
|
||||
return self.time_delta(datetime.datetime.now(), tgt_time=tgt_time, unit=unit)
|
||||
else:
|
||||
assert isinstance(now_time,datetime.datetime), f"incorrect type for now_time: {now_time} with type {type(now_time)}"
|
||||
return self.time_delta(now_time, tgt_time=tgt_time, unit=unit)
|
||||
|
||||
def time_inbetween(self, query_time:datetime.datetime, start_time:datetime.datetime, end_time:datetime.datetime) -> bool:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user