edx-enterprise icon indicating copy to clipboard operation
edx-enterprise copied to clipboard

feat: adds attribute to hide course prices when zero

Open tecoholic opened this issue 1 year ago • 18 comments

Description

This adds a new attribute hide_course_price_when_zero to the EnterpriseCustomer model, which will hide the pricing information from the enrollment page when the final price of a premium course mode is Zero.

Testing instructions

  1. Setup a working devstack setup for edx-enterprise. Required services: LMS, ECommerce, Discovery and Enterprise Catalog (this needs to be setup separately)
  2. Check out the PR branch
  3. OPTIONAL: Install edx-enterprise in your LMS container if not already installed.
    # From devstack dir
    make dev.shell.lms
    pip install -e /edx/src/edx-enterprise
    
  4. Apply the migrations
    # From devstack dir
    make dev.shell.lms
    ./manage.py lms migrate
    
  5. Go to enterprise customer admin page copy the UUID of the test enterprise
  6. Go to enterprise catalog admin page and copy the UUID of the catalog attached to test enterprise
  7. Go to discovery search page and copy the key of one of the courses included in the enterprise catalog. If you are using the "All course runs" catalog used in the devstack setup, then it can be any course's key which has a paid seat.
  8. Visit the URL http://localhost:18000/enterprise/<enterprise_uuid>/course/<course_key>/enroll/, eg., http://localhost:18000/enterprise/753e5f69-ef92-42ab-ba07-9326d76603e8/course/edX%2BP315/enroll/. This should show the course details along with the price of the course. Unchecked
  9. Go to the Ecommerce /courses/ page and add an Enterprise Offer using the enterprise and catalog UUIDs and set the discount percent to 100% (this will mark the final price to zero). Note: Use 006NFJHRVSD683NDI8 for the Salesforce opportunity ID for testing.
  10. Now refresh the enrollment page, it should show the final price as zero. Unchecked_zero Unchecked_zero_modal
  11. Go to the enterprise customer admin page and edit the test enterprise. Check the Hide course price when zero flag and save the customer.
  12. Refresh the enrollment page. The pricing information would have disappeared. image image

Merge checklist

  • [ ] Any new requirements are in the right place (do not manually modify the requirements/*.txt files)
    • base.in if needed in production but edx-platform doesn't install it
    • test-master.in if edx-platform pins it, with a matching version
    • make upgrade && make requirements have been run to regenerate requirements
  • [ ] make static has been run to update webpack bundling if any static content was updated
  • [x] ./manage.py makemigrations has been run
    • Checkout the Database Migration Confluence page for helpful tips on creating migrations.
    • Note: This must be run if you modified any models.
      • It may or may not make a migration depending on exactly what you modified, but it should still be run.
    • This should be run from either a venv with all the lms/edx-enterprise requirements installed or if you checked out edx-enterprise into the src directory used by lms, you can run this command through an lms shell.
      • It would be ./manage.py lms makemigrations in the shell.
  • [ ] Version bumped
  • [ ] Changelog record added
  • [ ] Translations updated (see docs/internationalization.rst but also this isn't blocking for merge atm)

Post merge

  • [ ] Tag pushed and a new version released
    • Note: Assets will be added automatically. You just need to provide a tag (should match your version number) and title and description.
  • [ ] After versioned build finishes in GitHub Actions, verify version has been pushed to PyPI
    • Each step in the release build has a condition flag that checks if the rest of the steps are done and if so will deploy to PyPi. (so basically once your build finishes, after maybe a minute you should see the new version in PyPi automatically (on refresh))
  • [ ] PR created in edx-platform to upgrade dependencies (including edx-enterprise)
    • This must be done after the version is visible in PyPi as make upgrade in edx-platform will look for the latest version in PyPi.
    • Note: the edx-enterprise constraint in edx-platform must also be bumped to the latest version in PyPi.

tecoholic avatar Jul 04 '23 13:07 tecoholic

Thanks for the pull request, @tecoholic!

What's next?

Please work through the following steps to get your changes ready for engineering review:

:radio_button: Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

:radio_button: Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

:radio_button: Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

:radio_button: Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently unmaintained.

To get help with finding a technical reviewer, tag the community contributions project manager for this PR in a comment and let them know that your changes are ready for review:

  1. On the right-hand side of the PR, find the Contributions project, click the caret in the top right corner to expand it, and check the "Primary PM" field for the name of your PM.
  2. Find their GitHub handle here.

Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

:bulb: As a result it may take up to several weeks or months to complete a review and merge your PR.

openedx-webhooks avatar Jul 04 '23 13:07 openedx-webhooks

Hi @Agrendalath! Are you able to re-run the checks here?

mphilbrick211 avatar Jul 19 '23 17:07 mphilbrick211

@mphilbrick211, done.

Agrendalath avatar Jul 19 '23 17:07 Agrendalath

@tecoholic, the failing TestEnterpriseUtils.test_get_all_field_names_1 test seems to be related to this PR. It's likely the order in the tests/test_utilities.py file.

Agrendalath avatar Jul 19 '23 17:07 Agrendalath

@Agrendalath I have fixed the test and updated the PR.

tecoholic avatar Jul 21 '23 15:07 tecoholic

@Agrendalath - the tests need to be enabled again, if you wouldn't mind :)

mphilbrick211 avatar Jul 24 '23 19:07 mphilbrick211

@mphilbrick211, the tests were already green when I saw your comment, but I rebased the branch just in case.

Side note: I don't have permission to approve the CI in this repository, but the tests are running correctly when I rebase the branch.

Agrendalath avatar Jul 31 '23 10:07 Agrendalath

@Agrendalath - thanks! is this now ready for review?

mphilbrick211 avatar Aug 02 '23 12:08 mphilbrick211

@mphilbrick211, yes. We will update the changelog and version after the review to avoid merge conflicts.

Agrendalath avatar Aug 02 '23 12:08 Agrendalath

Hi @openedx/enterprise-titans! Would someone be able to please review this for us? Thanks!

mphilbrick211 avatar Aug 02 '23 12:08 mphilbrick211

@Agrendalath - hi there! Would you mind enabling tests again?

mphilbrick211 avatar Aug 07 '23 18:08 mphilbrick211

@tecoholic, it looks like we need to change the migration prefix from 0175 to 0178.

Agrendalath avatar Aug 08 '23 08:08 Agrendalath

Hi @tecoholic! Some branch conflicts have popped up. Would you mind taking a look?

mphilbrick211 avatar Sep 12 '23 14:09 mphilbrick211

Hi @openedx/enterprise-titans! Is someone able to help review/merge this PR? If so, could you provide an ETA on when you'd be able to do so?

mphilbrick211 avatar Oct 03 '23 02:10 mphilbrick211

Hi @openedx/enterprise-titans - just following up to see when it will be possible to get this reviewed? Once you let us know, we'll address the failing tests.

mphilbrick211 avatar Oct 24 '23 20:10 mphilbrick211

Update: This PR has been rebased on the master and conflicts resolved.

tecoholic avatar Nov 09 '23 07:11 tecoholic

@openedx/enterprise-titans This PR has been rebased on master and DB migration has been updated to the latest number. Kindly review.

cc: @e0d

tecoholic avatar Dec 08 '23 10:12 tecoholic

Hi @openedx/2u-titans! Are you still still reviewing pull requests? If so, could you please review / merge this for us? Thank you!

mphilbrick211 avatar Feb 21 '24 14:02 mphilbrick211

Closing this as we don't use the ecommerce based flow anymore and won't be pursuing upstreaming of these changes.

cc: @Agrendalath

tecoholic avatar Aug 12 '24 04:08 tecoholic

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

openedx-webhooks avatar Aug 12 '24 04:08 openedx-webhooks