示例#1
0
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 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()
示例#3
0
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)
示例#4
0
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
示例#5
0
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
示例#6
0
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())
示例#8
0
 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())
示例#9
0
 def runQueryInternal(self, indexName, value):
     return DBLoggedMessage.find_by_index(indexName, value)
 def runQueryInternal(self, indexName, value):
     return DBLoggedMessage.find_by_index(indexName, value)