def test_is_overdue_checks_correctly(self): creation_date = "2020-08-10 13:00:00" completion_goal = 5 self.assertTrue(kronos.is_overdue(creation_date, completion_goal)) on_time_date = kronos.get_date_time_as_string() on_time_goal = 100 self.assertFalse(kronos.is_overdue(on_time_date, on_time_goal))
def update_table_with_note(self, note): self.rows_in_table = self.rows_in_table + 1 self.cursor.execute( "INSERT INTO {} ({}, {}, {}, {}, {}) VALUES (?, ?, ?, ?, ?)". format(self.table_name, *self.schema), (self.rows_in_table, kronos.get_date_time_as_string(), note, "NA", "NA"), ) self.connection.commit()
def insert_note(self, note): NotesFacade.increment_row_count() self.db.get_connection().execute( "INSERT INTO {} ({}, {}, {}, {}) VALUES (?, ?, ?, ?)".format( self.table_name, *self.schema ), ( NotesFacade.__rows_in_table, "NOTE", note, kronos.get_date_time_as_string(), ), ) self.db.get_connection().commit()
def insert_task(self, task, days_to_complete): TasksFacade.increment_row_count() self.db.get_cursor().execute( "INSERT INTO {} ({}, {}, {}, {}, {}, {}, {}, {}) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" .format(self.table_name, *self.schema), ( TasksFacade.__rows_in_table, "TASK", task, kronos.get_date_time_as_string(), "TBD", days_to_complete, "false", "false", ), ) self.db.get_connection().commit()
def complete_task(self, row_id): now = kronos.get_date_time_as_string() self.db.get_cursor().execute( f"UPDATE {self.table_name} SET is_complete = 'true', date_complete = '{now}' WHERE id = {row_id}" ) self.db.get_connection().commit()