From 2203ecd69cc1c5f8d823d48e5ad8dfbed9150c52 Mon Sep 17 00:00:00 2001 From: Kumi Date: Mon, 8 Aug 2022 10:37:41 +0000 Subject: [PATCH] Add logging queries --- src/reportmonster/classes/vessel.py | 3 +++ src/reportmonster/const.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/reportmonster/classes/vessel.py b/src/reportmonster/classes/vessel.py index 985a361..092e351 100644 --- a/src/reportmonster/classes/vessel.py +++ b/src/reportmonster/classes/vessel.py @@ -263,3 +263,6 @@ class Vessel: def getCourseModuleCompletion(self, moduleid: int): results = list(self.db._execute(QUERY_MODULE_COMPLETION, (moduleid,), ctype=DictCursor)) return results + + def writeLog(self, event, data): + self.db._execute(QUERY_LOG_INSERT, (event, data)) \ No newline at end of file diff --git a/src/reportmonster/const.py b/src/reportmonster/const.py index d43b097..c60de82 100644 --- a/src/reportmonster/const.py +++ b/src/reportmonster/const.py @@ -26,4 +26,6 @@ QUERY_COURSE_FIELDS = "SELECT * FROM mdl_customfield_category cat JOIN mdl_custo QUERY_COURSE_MODULES = "SELECT * FROM mdl_course_modules WHERE course = %s" QUERY_MODULE_COMPLETION = "SELECT * FROM mdl_course_modules_completion WHERE coursemoduleid = %s" +QUERY_LOG_INSERT = "INSERT INTO mdl_logstore_standard_log(eventname, other, origin) VALUES (%s, %s, 'monster')" + QUERY_WHERE_TIMESTAMPS = "WHERE %(column)s >= %(after)i AND %(column)s < %(before)i"