Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: return learner_state_counts as part of the admin assignments list API response #322

Merged

Conversation

adamstankiewicz
Copy link
Member

@adamstankiewicz adamstankiewicz commented Nov 7, 2023

In order to support the default behavior of DataTable filtering with checkboxes on the "Status" column of the "Assigned" table in the Learner Credit Management's budget detail page, the paginated response of the admin content assignments list API now returns a learner_state_counts field that will adhere to any queryset filters, etc.

Allows the frontend UI to iterate over learner_state_counts to display the following:

image

Example API response

{
    "next": null,
    "previous": null,
    "count": 21,
    "num_pages": 1,
    "current_page": 1,
    "start": 0,
    "results": [
        {
            "uuid": "b8cf11f9-8589-42d0-83d7-0e938636a8d8",
            "assignment_configuration": "d17b7d66-8289-404e-90a5-d534ead459f6",
            "learner_email": "[edx+018@example.com](mailto:edx+018@example.com)",
            "lms_user_id": null,
            "content_key": "ColumbiaX+CSMM.104x",
            "content_title": null,
            "content_quantity": -10000,
            "state": "allocated",
            "transaction_uuid": null,
            "last_notification_at": null,
            "actions": [],
            "recent_action": {
                "action_type": "assigned",
                "timestamp": "2023-11-07T13:29:44.086890Z"
            },
            "learner_state": "notifying",
            "error_reason": null
        },
       # ...
    ],
    "learner_state_counts": [
        {
            "learner_state": "notifying",
            "count": 20
        },
        {
            "learner_state": "waiting",
            "count": 1
        }
    ]
}

Updated DRF Spectacular docs

The Redoc page now includes the extra pagination fields that were not currently depicted as well as the new learner_state_counts field.

image

@adamstankiewicz adamstankiewicz changed the title feat: return learner_state_counts as part of the admin assignments list API response feat: return learner_state_counts as part of the admin assignments list API response Nov 7, 2023
@adamstankiewicz adamstankiewicz marked this pull request as ready for review November 7, 2023 17:34
Comment on lines -6 to -7
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter, extend_schema
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[inform] The removed imports are unused.

@adamstankiewicz adamstankiewicz merged commit bd26f90 into main Nov 7, 2023
@adamstankiewicz adamstankiewicz deleted the ags/admin-assignments-list-learner-state-counts branch November 7, 2023 19:35
katrinan029 added a commit that referenced this pull request Nov 13, 2023
fix: refactored code based on reviewer feedback

fix: allow non-opaque-keys as content key for allocate requests

fix: data migration to delete Actions sans Assignments, and use on_delete=CASCADE (#314)

chore: allow optional logging of Django's SQL

fix: missing content titles on assignments

feat: Try to populate lms_user_id on assignments during creation

This is an attempt to cover the case where learners are already
logged in at the moment of assignment.  This case is a hole left by the
work in ENT-7875 which only set out to cover the case where a learner
was logged out at the moment of assignment.

ENT-7874

feat: Added assignments in credits_available endpoint

feat: allowing consumers of the learner content assignment api to filter by email and content title

fix: lint error

chore: refactored

fix: updated failing tests

feat: fetch enterprise catalog content metadata, serialize for credits_available assignments

ENT-7878

feat: add course_type field to assignment content metadata serializer

feat: return `learner_state_counts` as part of the admin assignments list API response (#322)

feat: validate requested allocation price

feat: link learners during assignment allocation

ENT-7778 | Call task to link learners to enterprise customer during allocation,
and have that ask add a successful linked action.

fix: new approach to generate `learner_state_count` in admin assignments list API; add addtl ordering and filtering support (#324)

chore: rebase

fix: lint error

chore: added test coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants