Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
soitool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bachelor-paa-bittet
soitool
Commits
13f28950
Commit
13f28950
authored
5 years ago
by
morkolai
Browse files
Options
Downloads
Patches
Plain Diff
#68 Commiter til db der det er nødvendig
parent
6e612912
No related branches found
Branches containing commit
No related tags found
1 merge request
!43
#68 Kodebok-oppdatering gjennom GUI og lagre databaseendringer
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
soitool/codebook.py
+1
-1
1 addition, 1 deletion
soitool/codebook.py
soitool/database.py
+4
-0
4 additions, 0 deletions
soitool/database.py
with
5 additions
and
1 deletion
soitool/codebook.py
+
1
−
1
View file @
13f28950
...
...
@@ -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
'
w
ord
'
(Primary key) is editable in this row.
therefore, only column
'
W
ord
'
(Primary key) is editable in this row.
All columns except
'
Code
'
are editable.
This class initializes by connecting to database and selecting table.
...
...
This diff is collapsed.
Click to expand it.
soitool/database.py
+
4
−
0
View file @
13f28950
...
...
@@ -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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment