Esempio n. 1
0
 def get_team_count(self, topic):
     """Get the number of teams associated with this topic"""
     # If team_count is already present (possible if topic data was pre-processed for sorting), return it.
     if 'team_count' in topic:
         return topic['team_count']
     else:
         return get_team_count_query_set(
             [topic['id']], self.context['course_id'],
             self.context.get('organization_protection_status')).count()
Esempio n. 2
0
 def test_team_counter_get_team_count_query_set(self, username,
                                                expected_count):
     user = self.users[username]
     try:
         organization_protection_status = teams_api.user_organization_protection_status(
             user, COURSE_KEY1)
     except ValueError:
         self.assertFalse(CourseEnrollment.is_enrolled(user, COURSE_KEY1))
         return
     teams_query_set = teams_api.get_team_count_query_set(
         [self.topic_id], COURSE_KEY1, organization_protection_status)
     self.assertEqual(expected_count, teams_query_set.count())