Добавил новый датакласс для Деятельности трудочасов и настроил их динамическую подгрузку из Redmine

This commit is contained in:
2025-05-21 12:22:48 +03:00
parent aae6d8309a
commit 70232f15a0
8 changed files with 39 additions and 24 deletions

View File

@@ -1,8 +1,8 @@
import logging
import sqlite3 as sq
from classes import Activity, Tag
from enums import ActivityType
from classes import Activity, ActivityType, Tag
from enums import ActivityType as ActivityTypeEnum
logger = logging.getLogger(__name__)
@@ -60,7 +60,7 @@ class Database:
act.id,
act.time_spent,
act.task_id,
ActivityType.DEVELOPMENT
ActivityTypeEnum.DEVELOPMENT
)
)
self.con.commit()
@@ -93,11 +93,11 @@ class Database:
except Exception as e:
logger.debug(e)
def insert_activity_types(self, activity_types: dict):
def insert_activity_types(self, activity_types: list[ActivityType]):
cur = self.con.cursor()
for k,v in activity_types.items():
for activity_type in activity_types:
try:
cur.execute("INSERT INTO activity_types VALUES(?, ?)", (k, v))
cur.execute("INSERT INTO activity_types VALUES(?, ?)", (activity_type.id, activity_type.title))
self.con.commit()
except Exception as e:
logger.debug(e)