Merge pull request #16309 from edx/bbeggs/PLAT-1411

Replace SubfieldBase functionality PLAT-1411
This commit is contained in:
Brian Beggs
2017-10-27 10:41:32 -04:00
committed by GitHub
9 changed files with 42 additions and 18 deletions

View File

@@ -45,7 +45,7 @@ def get_problem_grade_distribution(course_id):
# Loop through resultset building data for each problem
for row in db_query:
curr_problem = UsageKey.from_string(row['module_state_key']).map_into_course(course_id)
curr_problem = row['module_state_key'].map_into_course(course_id)
# Build set of grade distributions for each problem that has student responses
if curr_problem in prob_grade_distrib:
@@ -85,7 +85,7 @@ def get_sequential_open_distrib(course_id):
# Build set of "opened" data for each subsection that has "opened" data
sequential_open_distrib = {}
for row in db_query:
row_loc = UsageKey.from_string(row['module_state_key']).map_into_course(course_id)
row_loc = row['module_state_key'].map_into_course(course_id)
sequential_open_distrib[row_loc] = row['count_sequential']
return sequential_open_distrib
@@ -122,7 +122,7 @@ def get_problem_set_grade_distrib(course_id, problem_set):
# Loop through resultset building data for each problem
for row in db_query:
row_loc = UsageKey.from_string(row['module_state_key']).map_into_course(course_id)
row_loc = row['module_state_key'].map_into_course(course_id)
if row_loc not in prob_grade_distrib:
prob_grade_distrib[row_loc] = {
'max_grade': 0,

View File

@@ -960,7 +960,7 @@ class ScoresClient(object):
# attached to them (since old mongo identifiers don't include runs).
# So we have to add that info back in before we put it into our lookup.
self._locations_to_scores.update({
UsageKey.from_string(location).map_into_course(self.course_key): self.Score(correct, total, created)
location.map_into_course(self.course_key): self.Score(correct, total, created)
for location, correct, total, created
in scores_qset.values_list('module_state_key', 'grade', 'max_grade', 'created')
})

View File

@@ -199,6 +199,7 @@ def issued_certificates(course_key, features):
# Report run date
for data in generated_certificates:
data['report_run_date'] = report_run_date
data['course_id'] = str(data['course_id'])
return generated_certificates

View File

@@ -1055,7 +1055,7 @@ class MembershipListView(ExpandableFieldViewMixin, GenericAPIView):
CourseAccessRole.objects.filter(user=request.user, role='staff').values_list('course_id', flat=True)
)
accessible_course_ids = [item for sublist in (enrolled_courses, staff_courses) for item in sublist]
if requested_course_id is not None and requested_course_id not in accessible_course_ids:
if requested_course_id is not None and requested_course_key not in accessible_course_ids:
return Response(status=status.HTTP_400_BAD_REQUEST)
if not specified_username_or_team:
@@ -1068,7 +1068,7 @@ class MembershipListView(ExpandableFieldViewMixin, GenericAPIView):
if requested_course_key is not None:
course_keys = [requested_course_key]
elif accessible_course_ids is not None:
course_keys = [CourseKey.from_string(course_string) for course_string in accessible_course_ids]
course_keys = accessible_course_ids
queryset = CourseTeamMembership.get_memberships(username, course_keys, team_id)
page = self.paginate_queryset(queryset)