-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Unit extensions API v2 for instructors dashboard #37783
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
base: master
Are you sure you want to change the base?
Unit extensions API v2 for instructors dashboard #37783
Conversation
|
Thanks for the pull request, @holaontiveros! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
b4b3387 to
55eef0e
Compare
|
|
||
| return extension_data | ||
|
|
||
| def list(self, request, *args, **kwargs): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
@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: |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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?
| def test_get_unit_extensions_with_no_mockups(self): | ||
| """ | ||
| Test unit extensions with mocked data. | ||
| """ |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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?
Description
Supporting information
fixes #37664
Testing instructions
example curl to test, make sure you have the right cookies and update the right IDs and details
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.