-
Notifications
You must be signed in to change notification settings - Fork 48
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: adds attribute to hide course prices when zero #1788
feat: adds attribute to hide course prices when zero #1788
Conversation
Thanks for the pull request, @tecoholic! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 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:
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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
b9eb7c8
to
62189af
Compare
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.
@tecoholic, feel free to squash the commits. Also, should we bump the version and update the changelog? Or will we do this after the upstream review to avoid frequent conflicts?
👍
- I tested this: checked that it's possible to hide prices
- I read through the code
- I checked for accessibility issues: n/a
- Includes documentation: n/a
- I made sure any change in configuration variables is reflected in the corresponding client's
configuration-secure
repository: n/a
except ValueError: | ||
LOGGER.warning( | ||
'hide_price_when_zero: Could not convert price of course mode "%s" to int.', | ||
mode['title'] |
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.
We could also log the final_price
here to understand why this happened.
try: | ||
numbers = re.findall(r'\d+', mode['final_price']) | ||
mode['hide_price'] = int(''.join(numbers)) == 0 | ||
except ValueError: |
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 can happen only when mode['original_price']
does not contain digits (mode['final_price']
is generated in get_course_final_price
).
Technically, it could also happen when the mode['min_price']
does not contain digits, but this should raise an exception in the format_price
function.
Is it even possible? If yes, what does it mean? Is the course free? We can keep this exception handling; I'm just curious.
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.
@Agrendalath To be fair, I didn't quite find an edge case while testing for this. The final final_price
is a formatted string from format_price
which is bound to either provide a properly formatted string, or throw an exception.
But for some reason, I wasn't comfortable with parsing string using regex with no safeguards, so added the try block.
62189af
to
ed04eed
Compare
Hi @Agrendalath! Are you able to re-run the checks here? |
ed04eed
to
fd9e9e9
Compare
@mphilbrick211, done. |
@tecoholic, the failing |
fd9e9e9
to
49c2823
Compare
@Agrendalath I have fixed the test and updated the PR. |
@Agrendalath - the tests need to be enabled again, if you wouldn't mind :) |
49c2823
to
eb73871
Compare
@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 - thanks! is this now ready for review? |
@mphilbrick211, yes. We will update the changelog and version after the review to avoid merge conflicts. |
Hi @openedx/enterprise-titans! Would someone be able to please review this for us? Thanks! |
eb73871
to
3a0c531
Compare
@Agrendalath - hi there! Would you mind enabling tests again? |
3a0c531
to
4320731
Compare
@tecoholic, it looks like we need to change the migration prefix from 0175 to 0178. |
Hi @tecoholic! Some branch conflicts have popped up. Would you mind taking a look? |
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? |
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. |
308d3ac
to
168f613
Compare
168f613
to
bf44e9a
Compare
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.
bf44e9a
to
2dfbafd
Compare
678cd9a
to
1abdabe
Compare
1abdabe
to
d4ac14d
Compare
@openedx/enterprise-titans This PR has been rebased on master and DB migration has been updated to the latest number. Kindly review. cc: @e0d |
Hi @openedx/2u-titans! Are you still still reviewing pull requests? If so, could you please review / merge this for us? Thank you! |
Closing this as we don't use the ecommerce based flow anymore and won't be pursuing upstreaming of these changes. cc: @Agrendalath |
@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. |
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
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'skey
which has a paid seat.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./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: Use006NFJHRVSD683NDI8
for the Salesforce opportunity ID for testing.Merge checklist
requirements/*.txt
files)base.in
if needed in production but edx-platform doesn't install ittest-master.in
if edx-platform pins it, with a matching versionmake upgrade && make requirements
have been run to regenerate requirementsmake static
has been run to update webpack bundling if any static content was updated./manage.py makemigrations
has been run./manage.py lms makemigrations
in the shell.Post merge
(so basically once your build finishes, after maybe a minute you should see the new version in PyPi automatically (on refresh))
make upgrade
in edx-platform will look for the latest version in PyPi.