feat: add CourseModePriceRequested filter#376
Conversation
| Arguments: | ||
| block (VerticalBlock): The VeriticalBlock instance which is being rendered. | ||
| block (VerticalBlock): The VerticalBlock instance which is being rendered. |
There was a problem hiding this comment.
Unrelated spelling change
There was a problem hiding this comment.
Pull request overview
Adds a new public filter to the openedx_filters.learning subdomain for determining the price a learner should be charged for a selected course mode, along with a basic passthrough test to validate default behavior when no pipeline is configured.
Changes:
- Added
CourseModePriceRequestedfilter (org.openedx.learning.course_mode.price.requested.v1) with arun_filter(user, course_mode_data, price)API. - Added a unit test verifying the filter returns the original inputs when no pipeline is configured.
- Fixed minor typos in an existing VerticalBlock-related docstring.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| openedx_filters/learning/filters.py | Introduces the new CourseModePriceRequested filter and corrects a docstring typo elsewhere in the module. |
| openedx_filters/learning/tests/test_filters.py | Adds a new test case covering the default passthrough behavior for the new filter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pwnage101
left a comment
There was a problem hiding this comment.
besides the minor assertion issue, this also still needs a version bump & changelog entry
00790b6 to
998c09f
Compare
998c09f to
4049968
Compare
| Arguments: | ||
| user (Any): The Django User object. | ||
| course_mode_data (Any): The selected course mode object. | ||
| price (float): Numerical price. |
There was a problem hiding this comment.
❌ The price in platform is derived from the min_price, which is consistently documented as int, not float: https://github.com/edx/edx-platform/blob/release-ulmo/common/djangoapps/course_modes/views.py#L389
- Please validate the above and make the change to
intaccordingly. - Furthermore, consider calling out the currency. I'm pretty sure the currency is annotated inside the course_mode_data, so this numeric price value has no dedicated currency, but also please validate that.
- Third and last, be clear if the value represents full (e.g. dollar) or fractional (e.g. cents) currency amounts.
There was a problem hiding this comment.
I know you just pushed a change to make this int, but see bullet points 2 and 3 above.
4049968 to
025a230
Compare
7af9d3e to
ba87304
Compare
Description
This new filter determines the price a learner should be charged based upon their course mode. It has two related PRs that show the full implementation and how it is tested (see below).
This ticket is split from #338, please reference for previous PR comments.
Supporting information
https://2u-internal.atlassian.net/browse/ENT-11573
edx/edx-platform#365
openedx/edx-enterprise#2556
Testing instructions
Testing instruction in the edx-enterprise PR!
Checklists
Check off if complete or not applicable:
Merge Checklist:
Post Merge: