Ejemplo n.º 1
0
 def get_last_workday(self):
     rows = []
     for row in self.get_rows():
         if kronos.get_day_of_week(kronos.get_date_time()) == "Monday":
             if kronos.is_previous_friday(row[3]):
                 rows.append(row)
         if kronos.is_yesterday(row[3]):
             rows.append(row)
     return rows
Ejemplo n.º 2
0
 def get_last_days_items(self):
     rows = []
     for row in self.get_raw_values():
         if kronos.get_day_of_week(kronos.get_date_time()) == "Monday":
             if kronos.is_previous_friday(row[1]):
                 rows.append(row)
         if kronos.is_yesterday(row[1]):
             rows.append(row)
     return rows
Ejemplo n.º 3
0
 def get_last_days_items(self):
     rows = []
     for row in self.cursor.execute("SELECT * FROM {}".format(
             self.table_name)):
         if kronos.get_day_of_week(kronos.get_date_time()) == "Monday":
             if kronos.is_previous_friday(row[1]):
                 item = self.__format_row(row)
                 rows.append(item)
         if kronos.is_yesterday(row[1]):
             item = self.__format_row(row)
             rows.append(item)
     return rows
Ejemplo n.º 4
0
 def test_is_yesterday(self):
     date_time = kronos.get_date_time_from_string("2020-07-20 18:14:21")
     self.assertTrue(kronos.is_yesterday(date_time_str, today=date_time))
     date_time = kronos.get_date_time_from_string("2020-07-19 18:14:21")
     self.assertFalse(kronos.is_yesterday(date_time_str, today=date_time))