示例#1
0
 def _csm_scores(self):
     """
     Lazily queries and returns all the scores stored in the user
     state (in CSM) for the course, while caching the result.
     """
     scorable_locations = [block_key for block_key in self.course_structure if possibly_scored(block_key)]
     return ScoresClient.create_for_locations(self.course.id, self.student.id, scorable_locations)
示例#2
0
 def _csm_scores(self):
     """
     Lazily queries and returns all the scores stored in the user
     state (in CSM) for the course, while caching the result.
     """
     scorable_locations = [block_key for block_key in self.course_structure if possibly_scored(block_key)]
     return ScoresClient.create_for_locations(self.course.id, self.student.id, scorable_locations)
 def _prefetch_scores(self, course_structure, course):
     """
     Returns the prefetched scores for the given student and course.
     """
     if not self._scores_client:
         scorable_locations = [block_key for block_key in course_structure if possibly_scored(block_key)]
         self._scores_client = ScoresClient.create_for_locations(
             course.id, self.student.id, scorable_locations
         )
         self._submissions_scores = submissions_api.get_scores(
             unicode(course.id), anonymous_id_for_user(self.student, course.id)
         )
示例#4
0
 def test_possibly_scored(self):
     course_key = CourseLocator(u'org', u'course', u'run')
     for block_type in self.possibly_scored_block_types:
         usage_key = BlockUsageLocator(course_key, block_type,
                                       'mock_block_id')
         self.assertTrue(scores.possibly_scored(usage_key))
示例#5
0
 def test_possibly_scored(self):
     course_key = CourseLocator(u'org', u'course', u'run')
     for block_type in self.possibly_scored_block_types:
         usage_key = BlockUsageLocator(course_key, block_type, 'mock_block_id')
         self.assertTrue(scores.possibly_scored(usage_key))