def get_today_checked_user_num(cls): now = get_current_time() midnight = pendulum.datetime( year=now.year, month=now.month, day=now.day, tz=now.tz ) query = cls.objects.filter(last_check_in_time__gte=midnight) return query.count()
def checkin(self): if not self.today_is_checked: traffic = randint(settings.MIN_CHECKIN_TRAFFIC, settings.MAX_CHECKIN_TRAFFIC) self.transfer_enable += traffic self.last_check_in_time = get_current_time() self.save() return True, traffic return False, 0