Show discount deadline in a timezone-aware way
Also, fix it and the access expiration deadline to not hardcode the date presentation in an American way.
This commit is contained in:
@@ -64,7 +64,7 @@ def get_discount_expiration_date(user, course):
|
||||
|
||||
time_limit_start = None
|
||||
try:
|
||||
saw_banner = ExperimentData.objects.get(user=user, experiment_id=REV1008_EXPERIMENT_ID, key=str(course))
|
||||
saw_banner = ExperimentData.objects.get(user=user, experiment_id=REV1008_EXPERIMENT_ID, key=str(course.id))
|
||||
time_limit_start = parse_datetime(saw_banner.value)
|
||||
except ExperimentData.DoesNotExist:
|
||||
return None
|
||||
|
||||
@@ -42,7 +42,7 @@ class TestApplicability(ModuleStoreTestCase):
|
||||
CourseModeFactory.create(course_id=self.course.id, mode_slug='verified')
|
||||
now_time = datetime.now(tz=pytz.UTC).strftime(u"%Y-%m-%d %H:%M:%S%z")
|
||||
ExperimentData.objects.create(
|
||||
user=self.user, experiment_id=REV1008_EXPERIMENT_ID, key=str(self.course), value=now_time
|
||||
user=self.user, experiment_id=REV1008_EXPERIMENT_ID, key=str(self.course.id), value=now_time
|
||||
)
|
||||
|
||||
holdback_patcher = patch(
|
||||
|
||||
@@ -12,6 +12,7 @@ from edx_django_utils.cache import RequestCache
|
||||
from web_fragments.fragment import Fragment
|
||||
|
||||
from common.djangoapps.course_modes.models import format_course_price, get_course_prices
|
||||
from common.djangoapps.util.date_utils import strftime_localized_html
|
||||
from lms.djangoapps.experiments.models import ExperimentData
|
||||
from lms.djangoapps.courseware.utils import verified_upgrade_deadline_link
|
||||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
||||
@@ -184,7 +185,7 @@ def generate_offer_html(user, course):
|
||||
'<div class="first-purchase-offer-banner" role="note">'
|
||||
'<span class="first-purchase-offer-banner-bold"><b>'
|
||||
),
|
||||
discount_expiration_date=data['expiration_date'].strftime('%B %d'),
|
||||
discount_expiration_date=strftime_localized_html(data['expiration_date'], 'SHORT_DATE'),
|
||||
percentage=data['percentage'],
|
||||
span_close=HTML('</b></span>'),
|
||||
div_close=HTML('</div>'),
|
||||
|
||||
Reference in New Issue
Block a user