added comments

This commit is contained in:
Valentijn
2026-03-18 19:57:30 +01:00
parent c271656f51
commit 47bb6585d1
4 changed files with 29 additions and 7 deletions

4
DB.py
View File

@@ -9,6 +9,7 @@ class Database:
def _setup_tables(self):
# create the shifts table.
cur = self._con.cursor()
cur.execute('''
CREATE TABLE IF NOT EXISTS shifts (
@@ -27,10 +28,12 @@ class Database:
def insert_shifts(self, shifts):
# start db connection
cur = self._con.cursor()
inserted = 0
for shift in shifts:
# parse all information from the shift
start = shift.get('start_datetime', 'N/A')
end = shift.get('end_datetime', 'N/A')
@@ -38,6 +41,7 @@ class Database:
duration = shift.get('duration', 'N/A')
description = shift.get('shift_remark', shift.get('description', 'N/A'))
# insert it into the db.
cur.execute("""
INSERT OR IGNORE INTO shifts
(shift_start, shift_end, department, duration, description)