diff --git a/DataStore.py b/DataStore.py index 968f158..2d66cb3 100644 --- a/DataStore.py +++ b/DataStore.py @@ -73,15 +73,21 @@ WHERE id = 0 return ct def updateCurrentTask(self, ct): + self.clearCurrentTask() + c = self.conn.cursor() + c.execute(''' +INSERT INTO history +VALUES (0, ?, ?) +''', (ct.taskid, ct.dt.strftime(HISTORY_DT_FMT))) + c.close() + self.conn.commit() + + def clearCurrentTask(self, ct): c = self.conn.cursor() c.execute(''' DELETE FROM history WHERE id = 0 ''') - c.execute(''' -INSERT INTO history -VALUES (0, ?, ?) -''', (ct.taskid, ct.dt.strftime(HISTORY_DT_FMT))) c.close() self.conn.commit()