当前位置: 首页>>代码示例>>Python>>正文


Python Student.all方法代码示例

本文整理汇总了Python中models.models.Student.all方法的典型用法代码示例。如果您正苦于以下问题:Python Student.all方法的具体用法?Python Student.all怎么用?Python Student.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.models.Student的用法示例。


在下文中一共展示了Student.all方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
    def run(self):
        """Computes student statistics."""

        enrollment = EnrollmentAggregator()
        scores = ScoresAggregator()
        student_scores = StudentAggregator()
        feedback = PostcourseAggregator()
        mapper = utils.QueryMapper(
            Student.all(), batch_size=500, report_every=1000)

        def map_fn(student):
            enrollment.visit(student)
            scores.visit(student)
	    student_scores.visit(student)

        mapper.run(map_fn)

        mapper = utils.QueryMapper(
            StudentAnswersEntity.all(), batch_size=500, report_every=1000)

        def map_fn1(student):
            feedback.visit(student)

        mapper.run(map_fn1)

        data = {
            'enrollment': {
                'enrolled': enrollment.enrolled,
                'unenrolled': enrollment.unenrolled},
            'scores': scores.name_to_tuple,
	    'students' : student_scores.name_to_tuple,
	    'feedback' : feedback.name_to_tuple}

        return data
开发者ID:ksh,项目名称:gpirecertification,代码行数:36,代码来源:dashboard.py

示例2: run

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
 def run(self):
     query = Student.all().filter('is_participant', True).run(limit=600)
     for student in query:
         yield {
                 'email': student.key().name(),
                 'group_id': student.group_id,
                 }
开发者ID:twiffy,项目名称:eabooc,代码行数:9,代码来源:student_csv.py

示例3: post

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
  def post(self):
    user = self.personalizePageAndGetUser()
    if not user:
      self.redirect(users.create_login_url(self.request.uri))
      return

    if (MAX_CLASS_SIZE and Student.all(keys_only=True).count() >= MAX_CLASS_SIZE):
      self.templateValue['course_status'] = 'full'
    else:
      # Create student record
      name = self.request.get('form01')

      # create new or re-enroll old student
      student = Student.get_by_email(user.email())
      if student:
        if not student.is_enrolled:
          student.is_enrolled = True
          student.name = name
      else:
        student = Student(key_name=user.email(), name=name, is_enrolled=True)
      student.put()

    # Render registration confirmation page
    self.templateValue['navbar'] = {'registration': True}
    self.render('confirmation.html')
开发者ID:maxwillzq,项目名称:AllAboutPython,代码行数:27,代码来源:utils.py

示例4: run

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
    def run(self):
        """Computes student statistics."""

        enrollment = EnrollmentAggregator()
        scores = ScoresAggregator()
        names = NamesAggregator()
        mapper = utils.QueryMapper(
            Student.all(), batch_size=500, report_every=1000)

        def map_fn(student):
            enrollment.visit(student)
            scores.visit(student)
            names.visit(student)

        mapper.run(map_fn)
        
        data = {
            'enrollment': {
                'enrolled': enrollment.enrolled,
                'unenrolled': enrollment.unenrolled},
            'scores': scores.name_to_tuple,
            'id': names.st_id
                }

        return data
开发者ID:PerceptumNL,项目名称:cb-energietransitie,代码行数:27,代码来源:dashboard.py

示例5: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
    def get(self):


        if not(Roles.is_course_admin(self.app_context)):
            self.redirect("preview")

        self.response.headers['Content-type'] = 'text/csv'
        self.response.headers['Content-disposition'] = 'attachment; filename=students.csv'


        course = self.get_course()

        assessments=[]

        for unit in course.get_units():
            if (unit.type=="A"):
                assessments.append(str(unit.unit_id))


        writer = UnicodeWriter(self.response.out)

        keys = Student.all(keys_only=True).run()

        rows=[]

        for key in keys:

            student=Student.get_by_key_name(key.name())

            rec={"email": key.name(), "name": student.name, "enrolled": unicode(student.is_enrolled), "dateEnrolled": unicode(student.enrolled_on) }

            if (student.scores):
                scores=json.loads(student.scores)

                for assessmentName, score in scores.iteritems():
                    rec[assessmentName]=str(score)


            rows.append(rec)

        headerRow = ["Email", "Name", "Is Enrolled", "Enrolled On"]

        for assessmentName in assessments:
            headerRow.append(course.find_unit_by_id(assessmentName).title)

        writer.writerow(headerRow)

        for row in rows:

            renderedRow=[row["email"],row["name"],row["enrolled"],row["dateEnrolled"]]

            for assessmentName in assessments:
                if (assessmentName in row):
                    renderedRow.append(row[assessmentName])
                else:
                    renderedRow.append("")

            writer.writerow(renderedRow)
开发者ID:graemian,项目名称:ami-mooc-pilot,代码行数:60,代码来源:utils.py

示例6: run

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
    def run(self):
        """Computes student statistics."""
        enrollment = self.EnrollmentAggregator()
        scores = self.ScoresAggregator()
        mapper = models_utils.QueryMapper(Student.all(), batch_size=500, report_every=1000)

        def map_fn(student):
            enrollment.visit(student)
            scores.visit(student)

        mapper.run(map_fn)

        data = {
            "enrollment": {"enrolled": enrollment.enrolled, "unenrolled": enrollment.unenrolled},
            "scores": scores.name_to_tuple,
        }

        return data
开发者ID:reachedu14,项目名称:traininginstitute,代码行数:20,代码来源:analytics.py

示例7: post

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
    def post(self):
        user = users.get_current_user()
        if user:
            email = user.email()
            self.templateValue["email"] = email
            self.templateValue["logoutUrl"] = users.create_logout_url("/")

        # Restrict the maximum course size to 250000 people
        # FIXME: you can change this number if you wish.
        students = Student.all(keys_only=True)
        if students.count() > 249999:
            self.templateValue["course_status"] = "full"

        # Create student record
        name = self.request.get("form01")
        student = Student(key_name=user.email(), name=name)
        student.put()

        # Render registration confirmation page
        navbar = {"registration": True}
        self.templateValue["navbar"] = navbar
        self.render("confirmation.html")
开发者ID:alu042,项目名称:bmed,代码行数:24,代码来源:utils.py

示例8: post

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
  def post(self):
    user = users.get_current_user()
    if user:
      email = user.email()
      self.templateValue['email'] = email
      self.templateValue['logoutUrl'] = users.create_logout_url('/')

    # Restrict the maximum course size to 250000 people
    # FIXME: you can change this number if you wish.
    students = Student.all(keys_only=True)
    if (students.count() > 249999):
      self.templateValue['course_status'] = 'full'

    # Create student record
    name = self.request.get('form01')
    student = Student(key_name=user.email(), name=name)
    student.put()

    # Render registration confirmation page
    navbar = {'registration': True}
    self.templateValue['navbar'] = navbar
    self.render('confirmation.html')
开发者ID:InDei-Haiti,项目名称:course-builder,代码行数:24,代码来源:utils.py

示例9: get_students

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
 def get_students(self):
     everyone = Student.all()
     return everyone
开发者ID:sidds1601,项目名称:BigDataMOOC,代码行数:5,代码来源:utils.py

示例10: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
    def get(self):
        """Handles GET requests."""
        if not self.personalize_page_and_get_enrolled():
            return

        
        self.template_value['navbar'] = {'statistics': True}
        
        #cogemos unidades, lecciones y alumnos
        unidades = self.get_units()
        alumnos = [s for s in Student.all()]
        curso = self.get_course()
        
        # dicceionarios auxliares para calculos intermedios
        media_examen = {}
        count_examen = {}
        examen_completado = {}
        
    #**** VARIABLES FINALES
        units = []
        assessments = []
        students = { 'total': 0, 'last_week': 0, 'last_month': 0 }
        

    #**** UNIDADES Y LECCIONES
    
        # Creamos estructura de unidades > lecciones para posteriormente realizar tracking de alumnos
        
        for unit in unidades:
            if unit.type == 'U': # si es unidad, cogemos actividades y creamos objeto
                
                lecciones = curso.get_lessons(unit.unit_id)
                my_lessons = []
                
                for lesson in lecciones:
                    my_lessons.append({'id': lesson.lesson_id, 'title': lesson.title, 'students': 0})
                    
                units.append({ 'id': int(unit.unit_id), 'title': unit.title, 'students': 0, 'lessons': my_lessons })
            
            if unit.type == 'A':
                assessments.append({ 'id': unit.unit_id, 'title': unit.title, 'studentsCompleted': 0, 'studentsDone': 0, 'average': 0})
        
        
        
    #**** ALUMNOS
        
        count_alumnos = len(alumnos)
        alumnos_week = 0
        alumnos_month = 0
        
        last_week = datetime.datetime.now() - datetime.timedelta(days=7)
        last_month = datetime.datetime.now() - datetime.timedelta(days=30)
        
        for alumno in alumnos:
            
            students['total'] += 1
            if alumno.enrolled_on >= last_week:
                students['last_week'] += 1 
            if alumno.enrolled_on >= last_month:
                students['last_month'] += 1 
            
            # Scores del alumno
            scores = curso.get_all_scores(alumno)
            
            for score in scores: # hacemos conteos y acumulaciones para las notas medias
                if score['completed'] == True:
                    examen_completado[score['id']] = examen_completado.get(score['id'], 0) + 1
                    
                media_examen[score['id']] = media_examen.get(score['id'], 0) + score['score']
                count_examen[score['id']] = count_examen.get(score['id'], 0) + 1
                
            # Tracking del alumno
            for unit in units:
                tracker = curso.get_progress_tracker()
                progress = tracker.get_or_create_progress(alumno)

                lecciones_hechas = 0
                lecciones_total = 0

                for lesson in unit['lessons']:
                    lecciones_total += 1

                    if(tracker.get_html_status(progress, unit['id'], lesson['id'])): #lección hecha
                        lecciones_hechas += 1
                        lesson['students'] += 1

                if(lecciones_hechas == lecciones_total):
                    unit['students'] += 1
                
                
        # Calculamos las notas medias
        for asm in assessments:
            if(media_examen[asm['id']] > 0):
                asm['average'] = media_examen[asm['id']] / count_examen[asm['id']]
    
            asm['studentsCompleted'] = examen_completado.get(asm['id'], 0)
        
        
        
        """Insertamos las variables de estadisticas"""
#.........这里部分代码省略.........
开发者ID:Domofera,项目名称:Domofera_MOOC,代码行数:103,代码来源:utils.py

示例11: get_students

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import all [as 别名]
 def get_students(self):
     """CGL-MOOC-Builder: return all students"""
     everyone = Student.all()
     return everyone
开发者ID:cglmoocs,项目名称:cgl-mooc-builder,代码行数:6,代码来源:utils.py


注:本文中的models.models.Student.all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。