Skip to content

Conversation

@holaontiveros
Copy link
Contributor

@holaontiveros holaontiveros commented Dec 17, 2025

Description

  • Adds a new endpoint to get the unit_extensions for a course that will be used on the new instructor dashboard
  • Modifies an utility function that needed to ignore values to unpack
  • Updates edx-when from 3.0.0 to 3.1.0 that has the data required for the new endpoint to import

Supporting information

fixes #37664

Testing instructions

  • Make sure you have a valid course blocks that can be considered for an extension
  • Use the example curl request to test

example curl to test, make sure you have the right cookies and update the right IDs and details

curl --location --request GET 'http://local.openedx.io:8000/api/instructor/v2/courses/course-v1:OEXCOM+101+2025_T1/unit_extensions' \
--header 'Accept: application/json, text/javascript, */*; q=0.01' \
--header 'Referer: http://local.openedx.io:8000/courses/course-v1:OEXCOM+101+2025_T1/instructor' \
--header 'Content-Type: application/json' \
--data-raw '{
    "block_id": "block-v1:OEXCOM+101+2025_T1+type@sequential+block@c3ccd3d1f91b42dfb2bff8185dba4d3b",
    "email_or_username": "javier",
    "due_datetime": "12/12/2025 12:12",
    "reason": "Just because"
}'

a possible valid example of response of the query looks like:

{
    "next": null,
    "previous": null,
    "count": 2,
    "num_pages": 1,
    "current_page": 1,
    "start": 0,
    "results": [
        {
            "username": "armando",
            "full_name": "",
            "email": "[email protected]",
            "unit_title": "Subsection",
            "unit_location": "block-v1:OEXCOM+101+2025_T1+type@sequential+block@c3ccd3d1f91b42dfb2bff8185dba4d3b",
            "extended_due_date": "2026-12-28T00:00:00Z"
        },
        {
            "username": "javier",
            "full_name": "",
            "email": "[email protected]",
            "unit_title": "Subsection",
            "unit_location": "block-v1:OEXCOM+101+2025_T1+type@sequential+block@c3ccd3d1f91b42dfb2bff8185dba4d3b",
            "extended_due_date": "2025-12-12T12:12:00Z"
        }
    ]
}

Deadline

None

Other information

Include anything else that will help reviewers and consumers understand the change.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Dec 17, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Dec 17, 2025

Thanks for the pull request, @holaontiveros!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@mphilbrick211 mphilbrick211 added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Dec 19, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Dec 19, 2025
@holaontiveros holaontiveros force-pushed the feature/unit_extensions_v2 branch from b4b3387 to 55eef0e Compare January 12, 2026 15:24
@holaontiveros holaontiveros marked this pull request as ready for review January 12, 2026 16:31
@holaontiveros holaontiveros changed the title [WIP] Unit extensions API v2 for instructors dashboard Unit extensions API v2 for instructors dashboard Jan 12, 2026

return extension_data

def list(self, request, *args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps rather than override list, we could just override filter_queryset to return the queryset passed into it.

Copy link
Contributor

@wgu-taylor-payne wgu-taylor-payne Jan 20, 2026

Choose a reason for hiding this comment

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

Removing list and not overriding filter_queryset works without error because there are no default filters in place. I think it would be good to explicitly set filter_backends = [] on the class.

- Adjust tests for more consistent behavior
- Add UnitDueDateExtension as a data interface
- Reduce code duplication
@dwong2708
Copy link
Contributor

@wgu-taylor-payne I believe I’ve addressed all the comments. Could you please take another look?

data = response.data
results = data['results']

for r in results:
Copy link
Contributor

Choose a reason for hiding this comment

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

We only expect one result for each run, correct? In that case, looping wouldn't be necessary.

course_id = str(self.course_key)
return reverse('instructor_api_v2:unit_extensions', kwargs={'course_id': course_id})

def test_get_unit_extensions_success(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could remove this one as the same things are covered in other tests.


@patch('lms.djangoapps.instructor.views.api_v2.edx_when_api.get_overrides_for_course')
@patch('lms.djangoapps.instructor.views.api_v2.get_units_with_due_date')
def test_get_unit_extensions_with_data(self, mock_get_units, mock_get_overrides):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think test_get_unit_extensions_with_no_mockups covers what we are tyring to test here, right?

Comment on lines +1274 to +1277
def test_get_unit_extensions_with_no_mockups(self):
"""
Test unit extensions with mocked data.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

The docstring and method name seem to clash.

self.assertEqual(len(results), 2)

# If there are results, verify the structure
extension = results[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm getting instructor data for results[0]. Is that expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

Date extensions - GET /api/instructor/v2/courses/<course_id>/unit_extensions?=blockId&

5 participants