From d120cc63b8013fc40f2e45f32a1d37b6364efa4c Mon Sep 17 00:00:00 2001 From: Valeria Prakopchyk Date: Tue, 4 Oct 2022 21:04:31 +0200 Subject: [PATCH 1/2] begin log --- services/log.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 services/log.py diff --git a/services/log.py b/services/log.py new file mode 100644 index 0000000..c835131 --- /dev/null +++ b/services/log.py @@ -0,0 +1,5 @@ + +class LogService: + @staticmethod + def createlog(): + \ No newline at end of file From 9862e1c5538399d8c3774833fa836551f707a486 Mon Sep 17 00:00:00 2001 From: Valeria Prakopchyk Date: Tue, 4 Oct 2022 21:43:56 +0200 Subject: [PATCH 2/2] create log added --- main.py | 6 +++++- services/log.py | 13 +++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 60e5b15..a47bb2c 100644 --- a/main.py +++ b/main.py @@ -1,16 +1,20 @@ +from venv import create from models.utils import DatabaseUtils from models.database import Database from ui.input_menu import InputMenu, EMAIL_VALIDATOR from views.login_menu import LoginMenu +from services.log import LogService def main(): Database.init() DatabaseUtils.init_city_data() - LoginMenu.display() + # LoginMenu.display() # test = InputMenu("test") # test.add_option("EMAIL", "email", "STR", "nick.leeman@hotmail.com", 0, 40, EMAIL_VALIDATOR) # test.do_input() # print(test.get_value("EMAIL")) + LogService.createlog("hoi", "hallo", "doei", True) + main() \ No newline at end of file diff --git a/services/log.py b/services/log.py index c835131..16263b9 100644 --- a/services/log.py +++ b/services/log.py @@ -1,5 +1,14 @@ +import sqlite3 +from datetime import datetime +from models.log import Log +from models.database import Database class LogService: @staticmethod - def createlog(): - \ No newline at end of file + def createlog(username, description, additional_information, suspicious): + now = datetime.now() + date_string = now.strftime("%d-%m-%Y") + time_string = now.strftime("%H:%M:%S") + new_log = Log(Database.connection, None, username, date_string, time_string, description, additional_information, suspicious) + + new_log.save()