Skip to content

Conversation

@kaizoku
Copy link
Contributor

@kaizoku kaizoku commented Feb 24, 2020

This PR updates the student features report to pull from UserProfile.meta['city'] if it is set, in favor over UserProfile.city.

Context:
There are two distinct ways to store a city for users in edx-platform: one directly in UserProfile.city, and another in UserProfile.meta.

UserProfile.meta is used by adding "city" to the extended_profile_fields. This is then available via the account settings editor. The UserProfile.city field is not used or available via the account settings page.

Conversely to use a City field in the registration form, the REGISTRATION_EXTRA_FIELDS["city"] must be configured, and then entries are stored in UserProfile.city, which can't later be edited from the account settings page since it's not included in the field set.

Since the UserProfile.meta['city'] field is not set unless specifically configured, we choose this over the UserProfile.city field when generating the student features report.

Dependencies: None

Testing instructions:

  1. Add "extended_profile_fields":"city" (to the SiteConfiguration)[http://localhost:18000/admin/site_configuration/siteconfiguration/1/change/]
  2. Set {"city": "Test City"} in the UserProfile.meta field for a (test user)[http://localhost:18000/admin/auth/user/5/change/].
  3. Generate a report of student profiles with the "Download profile information as CSV" button in the instructor view for the edX DemoX Course.
  4. Check that the "city" field is filled in from the value set in step Fix js that prevented single step OE problems (ie only self assessment) ... #2.

Reviewers

@kaizoku kaizoku requested a review from a team February 24, 2020 08:02
@openedx-webhooks
Copy link

openedx-webhooks commented Feb 24, 2020

Thanks for the pull request, @kaizoku! I've created OSPR-4114 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:

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

Please let us know once your PR is ready for our review and all tests are green.

@openedx-webhooks openedx-webhooks added needs triage open-source-contribution PR author is not from Axim or 2U labels Feb 24, 2020
@lgp171188
Copy link
Contributor

@kaizoku, 👍

  • I tested that the city field is now stored in UserProfile.meta.
  • I read through the code
  • I checked for accessibility issues NA
  • Includes documentation

@natabene
Copy link
Contributor

@kaizoku Thank you for your contribution. Please let me know once it is ready for our review.

@openedx-webhooks openedx-webhooks added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed needs triage labels Feb 24, 2020
@giovannicimolin
Copy link
Contributor

@natabene I've added this to the OSPR doc.

@openedx-webhooks openedx-webhooks added awaiting prioritization and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels Feb 25, 2020
@kaizoku
Copy link
Contributor Author

kaizoku commented Feb 26, 2020

@natabene thanks! This is ready for review.

@natabene
Copy link
Contributor

@giovannicimolin I am lining this up for our review.

@kaizoku
Copy link
Contributor Author

kaizoku commented Jun 1, 2020

@natabene, is this still in the queue for review?

@natabene
Copy link
Contributor

natabene commented Jun 3, 2020

@kaizoku Yes, it is still waiting for a review. We have very little bandwidth right now, so heads up it may take more time.

@kaizoku
Copy link
Contributor Author

kaizoku commented Jun 3, 2020

@natabene, understood. Thanks for the update!

@marcotuts
Copy link
Contributor

I'm moving this back to product review - It isn't clear to me what the impact here is between city/country - Can you help me understand what the impact is to the reports with this change?

@openedx-webhooks openedx-webhooks added product review PR requires product review before merging and removed open edx community review labels Oct 9, 2020
@kaizoku
Copy link
Contributor Author

kaizoku commented Oct 19, 2020

@marcotuts, since the city field is no longer updated in the UserProfile serializer (edx@ae0333c) or from the account settings view, this just removes it from the student profile report.

The side effect of the revert is that country isn't added as the final field of the report. I could add another commit to move country to the final field similar to the what the commit being reverted in this PR does, but still leave out the city field.

@marcotuts
Copy link
Contributor

Sounds good to me.

If the change currently results in the removal of the country field from the report I'd advocate for keeping that so we don't alter any workflow expectations here around that field, but removing the unused city field makes sense to me.

Pushing this past product review again thanks for the detail @kaizoku

@openedx-webhooks openedx-webhooks added awaiting prioritization and removed product review PR requires product review before merging labels Nov 3, 2020
@kaizoku
Copy link
Contributor Author

kaizoku commented Nov 4, 2020

Thanks for checking into this @marcotuts. I can confirm that this change keeps the country field, since it's still the field in use from the Account page and within the platform.

@natabene
Copy link
Contributor

natabene commented Nov 5, 2020

@bradenmacdonald Please feel free to continue with this as a core committer.

Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

@kaizoku From the code alone, it's not obvious why this is being done this way, so can you please:

  1. Add a comment to the code itself explaining the context here and/or linking to this PR? (e.g. # There are two separate places where the city value can be stored, one used by account settings and the other used by the registration form. If the account settings value (meta.city) is set, it takes precedence.
  2. Rebase and squash to one commit with a conventional commit message.

Since @lgp171188 hasn't approved this fully and I'm not sure if he tested it, I will then do a manual test, approve, and merge.

@arch-bom-gocd-alerts
Copy link

📣 💥 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:

git merge-base --is-ancestor 2e335653 josh/revert_city_student_features_report && echo "You're all set" || echo "Please rebase onto master or merge master to your branch"

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

…ation report

There are two distinct ways to store a city for users in edx-platform:
one directly in UserProfile.city, and another in UserProfile.meta.

Depending on configuration, both fields can be used. Though the
UserProfile.meta['city'] field is not set unless specifically configured,
so we choose this over the UserProfile.city field when generating the student
features report.

Additional details and discussion available on edx/edx-platform#23171
@kaizoku kaizoku force-pushed the josh/revert_city_student_features_report branch from d50319a to 1767838 Compare June 14, 2021 23:58
@kaizoku
Copy link
Contributor Author

kaizoku commented Jun 15, 2021

Thanks for the review and suggestions @bradenmacdonald. I used your suggested comment as it's pretty comprehensive for a concise comment. I rebased, squashed, and updated the commit message with some more details from our discussion here and a reference to this PR for all of the details.

I'm not positive if this qualifies as a "fix" or "feat" tag for the conventional commit type. I used "fix" since while it modifies a feature it seems more like a fix.

@edx-status-bot
Copy link

Your PR has finished running tests. There were no failures.

Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

👍

  • I tested this: set profile city, meta city, and both fields for three different users, confirmed that the report reads from both fields but prefers meta.
  • I read through the code
  • I checked for accessibility issues: n/a
  • Includes documentation: now has inline comment, yes

@bradenmacdonald bradenmacdonald merged commit ddffeaa into openedx:master Jun 16, 2021
@openedx-webhooks
Copy link

@kaizoku 🎉 Your pull request was merged!

Please take a moment to answer a two question survey so we can improve your experience in the future.

@bradenmacdonald bradenmacdonald deleted the josh/revert_city_student_features_report branch June 16, 2021 18:27
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

blarghmatey referenced this pull request in mitodl/edx-platform Aug 2, 2021
…ation report

There are two distinct ways to store a city for users in edx-platform:
one directly in UserProfile.city, and another in UserProfile.meta.

Depending on configuration, both fields can be used. Though the
UserProfile.meta['city'] field is not set unless specifically configured,
so we choose this over the UserProfile.city field when generating the student
features report.

Additional details and discussion available on edx/edx-platform#23171
Agrendalath referenced this pull request in open-craft/openedx-platform Nov 25, 2021
…ation report

There are two distinct ways to store a city for users in edx-platform:
one directly in UserProfile.city, and another in UserProfile.meta.

Depending on configuration, both fields can be used. Though the
UserProfile.meta['city'] field is not set unless specifically configured,
so we choose this over the UserProfile.city field when generating the student
features report.

Additional details and discussion available on edx/edx-platform#23171

(cherry picked from commit ddffeaa)
Agrendalath referenced this pull request in open-craft/openedx-platform Jan 20, 2022
…ation report

There are two distinct ways to store a city for users in edx-platform:
one directly in UserProfile.city, and another in UserProfile.meta.

Depending on configuration, both fields can be used. Though the
UserProfile.meta['city'] field is not set unless specifically configured,
so we choose this over the UserProfile.city field when generating the student
features report.

Additional details and discussion available on edx/edx-platform#23171

(cherry picked from commit ddffeaa)
Agrendalath referenced this pull request in open-craft/openedx-platform May 12, 2022
…ation report

There are two distinct ways to store a city for users in edx-platform:
one directly in UserProfile.city, and another in UserProfile.meta.

Depending on configuration, both fields can be used. Though the
UserProfile.meta['city'] field is not set unless specifically configured,
so we choose this over the UserProfile.city field when generating the student
features report.

Additional details and discussion available on edx/edx-platform#23171

(cherry picked from commit ddffeaa)
Agrendalath referenced this pull request in open-craft/openedx-platform Jun 7, 2022
…ation report

There are two distinct ways to store a city for users in edx-platform:
one directly in UserProfile.city, and another in UserProfile.meta.

Depending on configuration, both fields can be used. Though the
UserProfile.meta['city'] field is not set unless specifically configured,
so we choose this over the UserProfile.city field when generating the student
features report.

Additional details and discussion available on edx/edx-platform#23171

(cherry picked from commit ddffeaa)
Agrendalath referenced this pull request in open-craft/openedx-platform Jun 7, 2022
…ation report

There are two distinct ways to store a city for users in edx-platform:
one directly in UserProfile.city, and another in UserProfile.meta.

Depending on configuration, both fields can be used. Though the
UserProfile.meta['city'] field is not set unless specifically configured,
so we choose this over the UserProfile.city field when generating the student
features report.

Additional details and discussion available on edx/edx-platform#23171

(cherry picked from commit ddffeaa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.