Example #1
0
 def createStudent(self, studentId, msg):
     logInfo('{0} could not find student with id: {1} in database.  Creating new student'.format(self.serviceName, studentId), 3)
     studentUUID = str(uuid4())
     student = DBStudent(id=studentUUID, studentId=studentId, sessionIds=[], oAuthIds={}, studentModelIds={}, kcGoals={})
     student.save()
     self.studentCache[studentId] = student
     newStudentAlias = DBStudentAlias(trueId=studentUUID, alias=studentId)
     newStudentAlias.save()
     return student
 def createNewStudentModel(self, studentId):
     #DBStudentAlias List
     studentsWithId = DBStudentAlias.find_by_index("AliasIndex", studentId)
     
     if len(studentsWithId) == 0:
         logInfo('failed to find student alias {0}'.format(studentId), 1)
         student = self.createStudent(studentId, None)
         return WeightedStudentModelFactory().buildStudentModel(student)
     
     for studentAlias in studentsWithId:
         student = DBStudent.find_one(studentAlias.trueId)
         
         if student is None:
             logInfo('failed to find student with Id: {0} and alias {1}'.format(studentAlias.trueId, studentAlias.alias), 1)
             student = self.createStudent(studentId, None)
             return WeightedStudentModelFactory().buildStudentModel(student)
         else:
             return WeightedStudentModelFactory().buildStudentModel(student)
Example #3
0
    def createNewStudentModel(self, studentId):
        #DBStudentAlias List
        studentsWithId = DBStudentAlias.find_by_index("AliasIndex", studentId)

        if len(studentsWithId) == 0:
            logInfo('failed to find student alias {0}'.format(studentId), 1)
            student = self.createStudent(studentId, None)
            return WeightedStudentModelFactory().buildStudentModel(student)

        for studentAlias in studentsWithId:
            student = DBStudent.find_one(studentAlias.trueId)

            if student is None:
                logInfo(
                    'failed to find student with Id: {0} and alias {1}'.format(
                        studentAlias.trueId, studentAlias.alias), 1)
                student = self.createStudent(studentId, None)
                return WeightedStudentModelFactory().buildStudentModel(student)
            else:
                return WeightedStudentModelFactory().buildStudentModel(student)