From a888e78a432d2df439f2891f44c5f322eb295805 Mon Sep 17 00:00:00 2001 From: Arunmozhi Date: Thu, 6 Jul 2023 16:05:19 +0530 Subject: [PATCH 1/3] feat: add a flag to hide course prices in enrollment page when it is 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. Internal-ref: https://tasks.opencraft.com/browse/BB-7541 --- 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 +++ tests/test_enterprise/test_utils.py | 28 +++++++++++++++++++ tests/test_utilities.py | 1 + 9 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 enterprise/migrations/0155_auto_20230706_0810.py 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