diff --git a/soitool/codebook.py b/soitool/codebook.py index b1a5f3cc0f9cabfac71cc59bc8f62abf120d29c5..85c3f812290232810121f2b1a8f6a8d9e5215a28 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 7cbca53fae41914765c7206ac2d6317425812578..0f7f1838acbebc40699a3744c459b646d1e78673 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()