def initDerivedDataTables(): DBSystem.ensure_table() DBTask.ensure_table() DBTopic.ensure_table() DBSession.ensure_table() DBStudent.ensure_table() DBClass.ensure_table() DBStudentModel.ensure_table() DBClassModel.ensure_table() DBStudentAlias.ensure_table() DBKCTaskAssociations.ensure_table() DBAssistmentsItem.ensure_table() DBClasssAlias.ensure_table() DBLoggedMessage.ensure_table() DBCalendarData.ensure_table()
def getKCsForUserAfterAGivenTime(user, kc, time): filter = DBLoggedMessage(actor=user, verb=KC_SCORE_VERB, object=kc, result=None, speechAct=None, context=None, timestamp=time) return KCForUserAfterAGivenTimeQuery().runQuery(filter)
def getAllFeedbackForSingleUserAndTask(user, task, timestamp=None, returnFullMesage=True): context = {USER_ID_CONTEXT_KEY: user, TASK_ID_CONTEXT_KEY: task} filter = DBLoggedMessage(actor=None, verb=TASK_FEEDBACK_VERB, object=None, result=None, speechAct=None, context=context, timestamp=timestamp) feedback = UserTaskQuery().runQuery(filter, returnFullMesage) return feedback
def getKCsForAGivenUserAndTask(user, task, timestamp=None, returnFullMesage=True): context = {USER_ID_CONTEXT_KEY: user, TASK_ID_CONTEXT_KEY: task} filter = DBLoggedMessage(actor=user, verb=KC_SCORE_VERB, object=None, result=None, speechAct=None, context=context, timestamp=timestamp) kcScores = UserTaskQuery().runQuery(filter, returnFullMesage) return kcScores
def getTotalScoreForAGivenUserTaskAndKC(user, task, kc, timestamp=None, returnFullMesage=True): context = {USER_ID_CONTEXT_KEY: user, TASK_ID_CONTEXT_KEY: task} filter = DBLoggedMessage(actor=user, verb=KC_SCORE_VERB, object=kc, result=None, speechAct=None, context=context, timestamp=timestamp) kcScores = UserTaskQuery().runQuery(filter, returnFullMesage) return sum([x.getResult() for x in kcScores])
def _logMessage(self, msg): serializedMsg = serializeObject(msg) if len(serializedMsg) <= self._maxMsgSize and msg is not None: #incomingMsg = DBLoggedMessage(actor=msg.getActor(), verb=msg.getVerb(), object=msg.getObject(), result=msg.getResult(), speechAct=msg.getSpeechAct(), context=msg.getContext(), timestamp=msg.getTimestamp()) incomingMsg = DBLoggedMessage.convert(msg) incomingMsg.id = msg.getId() if msg.getVerb() != "Dump Logs" or msg.getVerb() != VALUE_VERB: incomingMsg.save() if msg.getVerb() == COMPLETED_VERB: #print(getKCsForUserAfterAGivenTime('p1', 'KC1',"2016-02-04T00:57:14.000Z")) #print(getAverageKCScoreAfterAGivenTime('p1', 'KC1', "2016-02-04T23:27:14.000Z")) #print(getTotalScoreForAGivenUserAndTask('p1', 'http://localhost:5533/QueryLogDebug.html?')) data = DBSession() data.task = 'http://localhost:5533/QueryLogDebug.html?' data.students = ['p1'] data.startTime = '2016-02-04T23:27:14.000Z' #performance = data.getFeedback(False) #print(performance) else: print("Message size too long for msg #: " + msg.getId())
def runQueryInternal(self, indexName, value): return DBLoggedMessage.find_by_index(indexName, value)