Ejemplo n.º 1
0
 def getDailyProgressResetTimeDelta(cls):
     currentDayUTC = time_utils.getServerTimeCurrentDay()
     dailyProgressResetTimeUTC = cls._getDailyProgressResetTimeUTC()
     untilRest = dailyProgressResetTimeUTC - currentDayUTC
     if untilRest < 0:
         untilRest += time_utils.ONE_DAY
     return untilRest
Ejemplo n.º 2
0
 def getNearestActivityTimeLeft(self):
     timeLeft = None
     if self.getStartTimeLeft() > 0:
         timeLeft = (self.getStartTimeLeft(), (0, time_utils.ONE_DAY))
     else:
         weekDays, timeIntervals = self.getWeekDays(), self.getActiveTimeIntervals()
         if len(weekDays) or len(timeIntervals):
             timeLeft = next(time_utils.ActivityIntervalsIterator(time_utils.getServerTimeCurrentDay(), time_utils.getServerRegionalWeekDay(), weekDays, timeIntervals))
     return timeLeft
Ejemplo n.º 3
0
 def getNearestActivityTimeLeft(self):
     timeLeft = None
     if self.getStartTimeLeft() > 0:
         timeLeft = (self.getStartTimeLeft(), (0, time_utils.ONE_DAY))
     else:
         weekDays, timeIntervals = self.getWeekDays(), self.getActiveTimeIntervals()
         if weekDays or timeIntervals:
             timeLeft = next(time_utils.ActivityIntervalsIterator(time_utils.getServerTimeCurrentDay(), time_utils.getServerRegionalWeekDay(), weekDays, timeIntervals))
     return timeLeft
Ejemplo n.º 4
0
    def isAvailable(self):
        if self.getStartTimeLeft() > 0:
            return ValidationResult(False, 'in_future')
        if self.isOutOfDate():
            return ValidationResult(False, 'out_of_date')
        weekDays = self.getWeekDays()
        if weekDays and time_utils.getServerRegionalWeekDay() not in weekDays:
            return ValidationResult(False, 'invalid_weekday')
        intervals = self.getActiveTimeIntervals()
        serverTime = time_utils.getServerTimeCurrentDay()
        if intervals:
            for low, high in intervals:
                if low <= serverTime <= high:
                    break
            else:
                return ValidationResult(False, 'invalid_time_interval')

        return ValidationResult(False, 'requirements') if not self._checkConditions() else ValidationResult(True, '')
Ejemplo n.º 5
0
    def isAvailable(self):
        if self.getStartTimeLeft() > 0:
            return (False, 'in_future')
        if self.isOutOfDate():
            return (False, 'out_of_date')
        if len(self.getWeekDays()) and time_utils.getServerRegionalWeekDay() not in self.getWeekDays():
            return (False, 'invalid_weekday')
        intervals = self.getActiveTimeIntervals()
        serverTime = time_utils.getServerTimeCurrentDay()
        if len(intervals):
            for low, high in intervals:
                if low <= serverTime <= high:
                    break
            else:
                return (False, 'invalid_time_interval')

        if not self._checkConditions():
            return (False, 'requirements')
        return (True, '')
Ejemplo n.º 6
0
def _getSvrUtcToday():
    return time_utils.getServerTimeCurrentDay()
def _getSvrUtcToday():
    return time_utils.getServerTimeCurrentDay()