From bbafc5ef420820eb0dd301938091b014135bdb9f Mon Sep 17 00:00:00 2001 From: Arunmozhi Date: Mon, 10 Jul 2023 19:00:03 +0530 Subject: [PATCH] feat: add a flag to hide course prices in enrollment page when zero This commit adds "hide_course_price_when_zero" attribute to the EnterpriseCustomer model which can be enabled to hide the course price information from showing up in the enrollment landing page, when the final price of the course is Zero. * fix: bump pip-tools version to 6.6.2 to get rid of CI error Internal-ref: https://tasks.opencraft.com/browse/BB-7541 --- CHANGELOG.rst | 5 ++++ enterprise/__init__.py | 2 +- enterprise/admin/forms.py | 1 + .../migrations/0155_auto_20230706_0810.py | 23 +++++++++++++++ enterprise/models.py | 5 ++++ .../enterprise_course_enrollment_page.html | 24 ++++++++-------- .../enterprise/templatetags/course_modal.html | 2 +- enterprise/utils.py | 24 ++++++++++++++++ enterprise/views.py | 4 +++ requirements/dev.txt | 2 +- tests/test_enterprise/test_utils.py | 28 +++++++++++++++++++ tests/test_utilities.py | 1 + 12 files changed, 107 insertions(+), 14 deletions(-) create mode 100644 enterprise/migrations/0155_auto_20230706_0810.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d354de2c2c..4b4b347a3e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,7 +17,12 @@ Unreleased ---------- * nothing +[3.42.9] +-------- +feat: add a flag to hide course prices in enrollment page when zero + [3.42.8] +-------- feat: add additional fields to EnterpriseCourseEnrollmentViewSet [3.42.7] diff --git a/enterprise/__init__.py b/enterprise/__init__.py index 2478874dae..dfbb99e9e0 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,6 +2,6 @@ Your project description goes here. """ -__version__ = "3.42.8" +__version__ = "3.42.9" default_app_config = "enterprise.apps.EnterpriseConfig" diff --git a/enterprise/admin/forms.py b/enterprise/admin/forms.py index 8d6c9234af..e69225c068 100644 --- a/enterprise/admin/forms.py +++ b/enterprise/admin/forms.py @@ -398,6 +398,7 @@ class Meta: "enable_audit_data_reporting", "replace_sensitive_sso_username", "hide_course_original_price", + "hide_course_price_when_zero", "enable_portal_code_management_screen", "enable_portal_subscription_management_screen", "enable_learner_portal", diff --git a/enterprise/migrations/0155_auto_20230706_0810.py b/enterprise/migrations/0155_auto_20230706_0810.py new file mode 100644 index 0000000000..afae75b55d --- /dev/null +++ b/enterprise/migrations/0155_auto_20230706_0810.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.15 on 2023-07-06 08:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('enterprise', '0154_alter_systemwideenterpriseuserroleassignment_unique_together'), + ] + + operations = [ + migrations.AddField( + model_name='enterprisecustomer', + name='hide_course_price_when_zero', + field=models.BooleanField(default=False, help_text='Specify whether course cost should be hidden in the landing page when the final price is zero.'), + ), + migrations.AddField( + model_name='historicalenterprisecustomer', + name='hide_course_price_when_zero', + field=models.BooleanField(default=False, help_text='Specify whether course cost should be hidden in the landing page when the final price is zero.'), + ), + ] diff --git a/enterprise/models.py b/enterprise/models.py index 7cdb362fd3..d2bfac1187 100644 --- a/enterprise/models.py +++ b/enterprise/models.py @@ -386,6 +386,11 @@ class Meta: help_text=_("The email address where learner's reply to enterprise emails will be delivered.") ) + hide_course_price_when_zero = models.BooleanField( + default=False, + help_text=_("Specify whether course cost should be hidden in the landing page when the final price is zero.") + ) + @property def enterprise_customer_identity_provider(self): """ diff --git a/enterprise/templates/enterprise/enterprise_course_enrollment_page.html b/enterprise/templates/enterprise/enterprise_course_enrollment_page.html index 1d4a777bdf..efb644a519 100644 --- a/enterprise/templates/enterprise/enterprise_course_enrollment_page.html +++ b/enterprise/templates/enterprise/enterprise_course_enrollment_page.html @@ -77,19 +77,21 @@

{{ confirmation_text }}

diff --git a/enterprise/templates/enterprise/templatetags/course_modal.html b/enterprise/templates/enterprise/templatetags/course_modal.html index 41e6f694e0..bc7965b9f3 100644 --- a/enterprise/templates/enterprise/templatetags/course_modal.html +++ b/enterprise/templates/enterprise/templatetags/course_modal.html @@ -25,7 +25,7 @@

{{ course_title