Ejemplo n.º 1
0
 def start_date(self):
   if self.horizon == "monthly":
     return TimeSplitter.month(TimeSplitter.now())
   elif self.horizon == "daily":
     return TimeSplitter.day(TimeSplitter.now())
   else:
     return None
Ejemplo n.º 2
0
 def start_date(self):
     if self.horizon == "monthly":
         return TimeSplitter.month(TimeSplitter.now())
     elif self.horizon == "daily":
         return TimeSplitter.day(TimeSplitter.now())
     else:
         return None
Ejemplo n.º 3
0
  def update_leaderboard(self, summary):
    new = self._history_to_leaderboard(summary)

    # update the all-time leaderboard
    self._update_leaderboard('all', new)

    # update the monthly leaderboard
    new['date'] = TimeSplitter.month(summary['date'])
    self._update_leaderboard('monthly', new)

    # update the daily leaderboard
    new['date'] = TimeSplitter.day(summary['date'])
    self._update_leaderboard('daily', new)
Ejemplo n.º 4
0
    def update_leaderboard(self, summary):
        new = self._history_to_leaderboard(summary)

        # update the all-time leaderboard
        self._update_leaderboard('all', new)

        # update the monthly leaderboard
        new['date'] = TimeSplitter.month(summary['date'])
        self._update_leaderboard('monthly', new)

        # update the daily leaderboard
        new['date'] = TimeSplitter.day(summary['date'])
        self._update_leaderboard('daily', new)
Ejemplo n.º 5
0
  def test_default(self):
    result = TimeSplitter.month(datetime.datetime(2015, 2, 20, 12, 20, 30))
    expected = datetime.datetime(2015, 2, 1, 0, 0, 0)

    self.assertEqual(result, expected)