-
Notifications
You must be signed in to change notification settings - Fork 196
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: add extra fields to ORA staff graded serializer #2076
feat: add extra fields to ORA staff graded serializer #2076
Conversation
Thanks for the pull request, @nandodev-net! 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 as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. This is currently a draft pull request. When it is ready for our review and all tests are green, click "Ready for Review", or remove "WIP" from the title, as appropriate. |
# For team submissions, this is intentionally empty | ||
return None | ||
|
||
|
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.
/api/ora_staff_grader/initialize
upgraded
Hey @nandodev-net, thank you for this contribution! Let us know when the changes are ready for review. |
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.
This looks good, but one style change and one suggested simplification improvement
from openassessment.data import (OraSubmissionAnswerFactory, VersionNotFoundException, map_anonymized_ids_to_emails, | ||
map_anonymized_ids_to_fullname, map_anonymized_ids_to_usernames) |
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.
style nit
from openassessment.data import (OraSubmissionAnswerFactory, VersionNotFoundException, map_anonymized_ids_to_emails, | |
map_anonymized_ids_to_fullname, map_anonymized_ids_to_usernames) | |
from openassessment.data import ( | |
OraSubmissionAnswerFactory, | |
VersionNotFoundException, | |
map_anonymized_ids_to_emails, | |
map_anonymized_ids_to_fullname, | |
map_anonymized_ids_to_usernames | |
) |
@@ -95,6 +95,48 @@ def map_anonymized_ids_to_usernames(anonymized_ids): | |||
|
|||
return anonymous_id_to_username_mapping | |||
|
|||
def map_anonymized_ids_to_emails(anonymized_ids): |
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.
Here's an idea, rather than having these all be separate, and adding a new function every time we want more user data, why not do something like
def map_anonymized_ids_to_user_data(anonymized_ids):
"""
Args:
anonymized_ids - list of anonymized user ids.
Returns:
dict {
<anonymous_user_id> : {
'email': (str) <user.email>
'username': (str) <user.username>
'fullname': (str) <user.profile.name>
}
}
"""
User = get_user_model()
users = _use_read_replica(
User.objects.filter(anonymoususerid__anonymous_user_id__in=anonymized_ids)
.select_related("profile")
.annotate(
anonymous_id=F("anonymoususerid__anonymous_user_id")),
fullname=F("profile__name"),
)
.values("username", "email", "fullname", "anonymous_id")
)
anonymous_id_to_user_info_mappnig = {
user["anonymous_id"]: user for user in users
}
return anonymous_id_to_user_info_mapping
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 like that idea. If we make this change, we'd also need to modify: https://github.com/openedx/edx-ora2/pull/2076/files#diff-4708da322d3d3b03cd269f5aa9574e7b1708cd6e665f1c25b2ba2570ca18dfefR98-R113 (and probably more) so we keep the implementation consistent.
Sorry, that was meant to be a "comment" rather than a "request changes" |
@nandodev-net It looks like your changes already went through a round of engineering review. Once you're done addressing the feedback, can you mark this PR as ready (= remove it from Draft state)? |
Hey @nandodev-net, just checking in to see if you're still planning to continue working on this PR? |
Hi @nandodev-net! Just a quick update that we're closing this PR now because it is stale. You may reopen this pull request, or open a new one, when you have time to come back to this work. |
@nandodev-net 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. |
feat: endpoint
/api/ora_staff_grader/initialize
upgradedImplementation Details
This PR adds the
fullname
andemail
fields to the/api/ora_staff_grader/initialize
endpoint.Modifications were made in the following directories:
ORA2
edx-platform
This upgrade will consist of two PRs: one for ORA and the other for edx-platform. This is because the main serializer of the service resides in the platform. To test it, you'll need to fetch and set up the version of the platform with the serializer modification.