Настроил динамическую загрузку Ветро проектов (Tasks) из Clockify и добавил новый аргумент для обновления базы данных с серверов

This commit is contained in:
2025-05-21 12:55:27 +03:00
parent 70232f15a0
commit 38a8461070
9 changed files with 49 additions and 15 deletions

View File

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