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
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
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
def test_is_previous_friday(self): last_friday = "2020-08-14 13:00:00" last_monday = kronos.get_date_time_from_string("2020-08-17 13:00:00") self.assertTrue(kronos.is_previous_friday(last_friday, last_monday)) last_tuesday = kronos.get_date_time_from_string("2020-08-18 13:00:00") self.assertFalse(kronos.is_previous_friday(last_friday, last_tuesday))