From 13f28950c427dd9bd1420fe0595f015efb1778b7 Mon Sep 17 00:00:00 2001 From: morkolai <nikolai-mork@live.no> Date: Mon, 23 Mar 2020 08:16:26 +0100 Subject: [PATCH] =?UTF-8?q?#68=20Commiter=20til=20db=20der=20det=20er=20n?= =?UTF-8?q?=C3=B8dvendig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soitool/codebook.py | 2 +- soitool/database.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/soitool/codebook.py b/soitool/codebook.py index b1a5f3c..85c3f81 100644 --- a/soitool/codebook.py +++ b/soitool/codebook.py @@ -92,7 +92,7 @@ class CodeBookTableModel(QSqlTableModel): when a value is changed by the view. The last row is used by the view to insert a new database record, - therefore, only column 'word' (Primary key) is editable in this row. + therefore, only column 'Word' (Primary key) is editable in this row. All columns except 'Code' are editable. This class initializes by connecting to database and selecting table. diff --git a/soitool/database.py b/soitool/database.py index 7cbca53..0f7f183 100644 --- a/soitool/database.py +++ b/soitool/database.py @@ -144,6 +144,7 @@ class Database: """Update Timestamp in LastUpdated to current time.""" stmt = "UPDATE LastUpdated SET Timestamp = ?" self.conn.execute(stmt, (str(datetime.now()),)) + self.conn.commit() def get_categories(self): """ @@ -230,6 +231,8 @@ class Database: self.conn.execute(stmt, (codes.pop(), words[i][0])) # Updates LastUpdated with current time self.update_last_updated() + # Save changes in db + self.conn.commit() print("Code in CodeBook updated") @@ -329,3 +332,4 @@ class Database: # Insert code to the param word in db stmt = "UPDATE CodeBook SET Code = ? WHERE Word = ?" self.conn.execute(stmt, (code, word)) + self.conn.commit() -- GitLab