(BB-1389) Update enrollment serializer and Add problem submission history endpoint - #20948
(BB-1389) Update enrollment serializer and Add problem submission history endpoint#20948xirdneh wants to merge 6 commits into
Conversation
|
Thanks for the pull request, @xirdneh! I've created OSPR-3715 to keep track of it in JIRA, where we prioritize reviews. Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
1e29e62 to
0a1f0bf
Compare
3f8f529 to
6d3afeb
Compare
kaizoku
left a comment
There was a problem hiding this comment.
I did some manual testing and things work alright, but I have a couple small comments and a question I'm not sure about.
| EnrollmentCourseDetailView.as_view(), name='courseenrollmentdetails'), | ||
| url(r'^unenroll/$', UnenrollmentView.as_view(), name='unenrollment'), | ||
| url(r'^roles/$', EnrollmentUserRolesView.as_view(), name='roles'), | ||
| url(r'^submission_history$', SubmissionHistoryView.as_view()), |
There was a problem hiding this comment.
This view should likely also have a name= parameter
There was a problem hiding this comment.
@kaizoku What do you mean by a name= parameter?
Right now it accepts a user= parameter which is the username. If we add a name= parameter should it be user's name?
There was a problem hiding this comment.
@kaizoku I've updated the view's documentation, hopefully that'll resolve any issues.
There was a problem hiding this comment.
I mean in the url() definition here, like:
url(r'^submission_history$', SubmissionHistoryView.as_view(), name='submission_history'),
| """ | ||
| course_details = CourseSerializer(source="course_overview") | ||
| user = serializers.SerializerMethodField('get_username') | ||
| finished = serializers.SerializerMethodField() |
There was a problem hiding this comment.
We should probably also specify the method name as is done for the user field.
There was a problem hiding this comment.
@kaizoku we can't do this because there's a quality error raised:
AssertionError: It is redundant to specify `get_finished` on SerializerMethodField 'finished' in serializer 'CourseEnrollmentSerializer', because it is the same as the default method name. Remove the `method_name` argument.
| if section.get(u'prominent'): | ||
| summary.append(section) | ||
| except PermissionDenied: | ||
| pass |
There was a problem hiding this comment.
This won't do anything if it fails permission checks, should we instead return an empty response?
This would wind up looking like a 0% grade instead, but perhaps that's the correct behavior, I'm not sure.
There was a problem hiding this comment.
The values are initialized at the beginning of the method. If there's a permission issue the response would be:
{
'current_grade': 0,
'certificate_eligible': False,
'summary': [],
}There was a problem hiding this comment.
Right, I'm wondering if it would be better to imply an empty grade like that, or to return an empty list entirely.
There was a problem hiding this comment.
@kaizoku I think to avoid issues on the frontend it's better to return an empty grade like this. That way the front-end code doesn't have to change if there's a permission error.
Now, I think probably a better solution would be to return a 403. You think that's acceptable?
There was a problem hiding this comment.
I'm not sure, perhaps the edX reviewer will have some ideas on this?
There was a problem hiding this comment.
@ormsbee Can you comment on this change? Is this approach feasible?
4032ebb to
abbe321
Compare
|
@xirdneh Thank you for your contribution. Is this ready for our review? |
|
@natabene I believe this is ready for review, yes. |
|
@ormsbee This is ready for your review when you have a chance. |
|
@edx/platform-core @ormsbee Friendly ping :) |
|
jenkins run all |
|
@xirdneh Can you provide more information about what this does? |
|
@natabene I'm taking over this PR. This essentially implements a new API endpoint to retrieve students problem submission history for a specific course. It includes necessary improvements to serialisers for the data being returned. |
3a36ee0 to
f12c39f
Compare
09a2ec1 to
d5c5e67
Compare
|
Your PR has finished running tests. The following contexts failed:
|
|
📣 💥 Heads-up: You must either rebase onto master or merge master into your branch to avoid breaking the build. We recently removed diff-quality and introduced lint-amnesty. This means that the automated quality check that has run on your branch doesn't work the same way it will on master. If you have introduced any quality failures, they might pass on the PR but then break the build on master. This branch has been detected to not have commit 2e33565 as an ancestor. Here's how to see for yourself: If you have any questions, please reach out to the Architecture team (either #edx-shared-architecture on Open edX Slack or #architecture on edX internal). |
|
@viadanna Could you please take a look at the a11y failures and the request to rebase? |
I'm looking into this, the PR is so old that it started failing without any changes. I'll schedule a couple hours to check this. |
|
Thank you for checking it @viadanna! |
| pass | ||
| return [ | ||
| {u'current_grade': current_grade, | ||
| u'certificate_eligible': course_grade.passed if course_grade else False, |
There was a problem hiding this comment.
This is not consistent with the certificates API, so it can return different values than generated grade reports.
There was a problem hiding this comment.
Thanks for catching this @Agrendalath possibly one of the changes that have been impacting this PR since it has been created. I'll schedule some time to look into this, resolve conflicts and fix tests.
|
Closing as the code become stale and we no longer need these changes at OpenCraft. |
|
@xirdneh Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |
… endpoint (squashed and cherry picked from openedx#20948) NOTE 1: during a next release preparation, don't cherry-pick the original commit, as they are heavily outdated. Cherry-pick this one, as it has linting and compatibility fixes. NOTE 2: `max_mongo_calls` in `EnrollmentTestMixin` was bumped from 8 to 12.
(BB-1389) Update enrollment serializer and Add problem submission history endpoint Squashed all commits from https://github.com/edx/edx-platform/pull/20948 (cherry picked from commit c102e41c6d92e5fb7db66de4d3624f03da213631) This cherry-pick was modified and updates works with mango.
(BB-1389) Update enrollment serializer and Add problem submission history endpoint Squashed all commits from https://github.com/edx/edx-platform/pull/20948 (cherry picked from commit c102e41c6d92e5fb7db66de4d3624f03da213631) This cherry-pick was modified and updated to work with mango.
(BB-1389) Update enrollment serializer and Add problem submission history endpoint Squashed all commits from https://github.com/edx/edx-platform/pull/20948 (cherry picked from commit c102e41c6d92e5fb7db66de4d3624f03da213631) This cherry-pick was modified and updated to work with mango.
(BB-1389) Update enrollment serializer and Add problem submission history endpoint Squashed all commits from https://github.com/edx/edx-platform/pull/20948 (cherry picked from commit c102e41c6d92e5fb7db66de4d3624f03da213631) This cherry-pick was modified and updated to work with mango.
(BB-1389) Update enrollment serializer and Add problem submission history endpoint Squashed all commits from https://github.com/edx/edx-platform/pull/20948 (cherry picked from commit c102e41c6d92e5fb7db66de4d3624f03da213631) This cherry-pick was modified and updated to work with mango.
(BB-1389) Update enrollment serializer and Add problem submission history endpoint Squashed all commits from https://github.com/edx/edx-platform/pull/20948 (cherry picked from commit c102e41c6d92e5fb7db66de4d3624f03da213631) This cherry-pick was modified and updated to work with mango.
Introduction
Another description as I don't have permission to edit the above.
This PR adds an endpoint displaying the submission history for each course a specific user is enrolled.
Sandbox URL: https://pr20948.sandbox.opencraft.hosting/ (provisioning)
Testing instructions
These can use the sandbox above or a devstack.
Screenshots
Author notes and concerns