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: add extra fields to ORA staff graded serializer #2076

Conversation

nandodev-net
Copy link

@nandodev-net nandodev-net commented Oct 16, 2023

feat: endpoint /api/ora_staff_grader/initialize upgraded

Peek 2023-10-13 20-47

Implementation Details

This PR adds the fullname and email fields to the /api/ora_staff_grader/initialize endpoint.
Modifications were made in the following directories:

ORA2

  • openassessment/staffgrader/serializers/submission_list.py
  • openassessment/staffgrader/staff_grader_mixin.py
  • openassessment/data.py

edx-platform

  • lms/djangoapps/ora_staff_grader/serializers.py

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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 16, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Oct 16, 2023

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:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

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


Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

@nandodev-net nandodev-net changed the title feat: endpoint /api/ora_staff_grader/initialize upgraded feat: add extra fields to ORA staff graded serializer Oct 16, 2023
@itsjeyd itsjeyd added the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label Oct 17, 2023
@itsjeyd
Copy link

itsjeyd commented Oct 17, 2023

Hey @nandodev-net, thank you for this contribution! Let us know when the changes are ready for review.

Copy link
Contributor

@jansenk jansenk left a 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

Comment on lines +18 to +19
from openassessment.data import (OraSubmissionAnswerFactory, VersionNotFoundException, map_anonymized_ids_to_emails,
map_anonymized_ids_to_fullname, map_anonymized_ids_to_usernames)
Copy link
Contributor

Choose a reason for hiding this comment

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

style nit

Suggested change
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):
Copy link
Contributor

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

Copy link
Member

@mariajgrimaldi mariajgrimaldi Oct 18, 2023

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.

@jansenk jansenk self-requested a review October 18, 2023 14:55
@jansenk
Copy link
Contributor

jansenk commented Oct 18, 2023

Sorry, that was meant to be a "comment" rather than a "request changes"

@itsjeyd
Copy link

itsjeyd commented Nov 8, 2023

@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)?

@itsjeyd
Copy link

itsjeyd commented Dec 14, 2023

Hey @nandodev-net, just checking in to see if you're still planning to continue working on this PR?

@itsjeyd itsjeyd added the inactive PR author has been unresponsive for several months label Dec 14, 2023
@itsjeyd
Copy link

itsjeyd commented Jan 11, 2024

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.

@itsjeyd itsjeyd closed this Jan 11, 2024
@openedx-webhooks
Copy link

@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.

@itsjeyd itsjeyd added closed inactivity PR was closed because the author abandoned it and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. inactive PR author has been unresponsive for several months labels Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed inactivity PR was closed because the author abandoned it open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants