def _first_of_month_refresh(self, now=None): if not now: now = timezone.now() increase_date = timezone.datetime(now.year, now.month, 1, tzinfo=timezone.utc) return OneTimeRefresh(increase_date)
def _anniversary_month_refresh(self, identity, now=None): if not now: now = timezone.now() one_month = relativedelta(months=1) user_join = identity.created_by.date_joined monthiversary = timezone.datetime( now.year, now.month, user_join.day, tzinfo=timezone.utc) increase_date = monthiversary \ if user_join.day > now.day \ else monthiversary - one_month return OneTimeRefresh(increase_date)
def _no_refresh(self, identity): user_join = identity.created_by.date_joined return OneTimeRefresh(user_join)
def _one_refresh(self, start_date): return OneTimeRefresh(start_date)