Exemplo 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
Exemplo 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
Exemplo 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
Exemplo n.º 4
0
 def test_get_day_of_week(self):
     for i in range(len(kronos.week_days)):
         date = kronos.get_date_time_from_string(
             f"2020-08-{10 + i} 13:00:00")
         self.assertEqual(kronos.week_days.get(i),
                          kronos.get_day_of_week(date))
Exemplo n.º 5
0
 def test_get_day_of_week(self):
     date_time = datetime.datetime.strptime(date_time_str, string_format_time)
     self.assertEqual("Sunday", kronos.get_day_of_week(date_time))