Add logging queries

This commit is contained in:
Kumi 2022-08-08 10:37:41 +00:00
parent 7257ba1985
commit 2203ecd69c
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 5 additions and 0 deletions

View file

@ -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))

View file

@ -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"