Skip to content

Commit

Permalink
Merge pull request #465 from openedx/asheehan-edx/sort-by-enrollment-…
Browse files Browse the repository at this point in the history
…num-pages-fix

fix: updating group members with aggregate pagination num pages
  • Loading branch information
alex-sheehan-edx authored May 9, 2024
2 parents 8975f08 + 70f5d88 commit 581356b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions enterprise_access/apps/api/v1/views/subsidy_access_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
REST API views for the subsidy_access_policy app.
"""
import logging
import math
import os
from collections import defaultdict
from contextlib import suppress
Expand Down Expand Up @@ -123,6 +124,9 @@ def _update_pagination_params_for_group_aggregates(
member_response['next'] = None
member_response['previous'] = None

if sort_by_enrollment_count:
member_response['num_pages'] = math.ceil(num_member_results / GROUP_MEMBERS_WITH_AGGREGATES_DEFAULT_PAGE_SIZE)


def zip_group_members_data_with_enrollment_count(member_results, subsidy_learner_aggregate_dict):
"""Helper method to zip group member results with aggregate data from the subsidy service"""
Expand Down

0 comments on commit 581356b

Please sign in to comment.