Commit caef5850 by Clinton Blackburn

Removed Enrollment Stats for Previous Day and Month

parent 8b7000bf
......@@ -80,10 +80,11 @@ class CourseEnrollmentActivityTests(CourseEnrollmentTests, WebAppTest):
current_enrollment_count = current_enrollment['count']
self.assertSummaryPointValueEquals('current_enrollment', current_enrollment_count)
for i in [1, 7, 30]:
stat_type = 'enrollment_change_last_%s_days' % i
value = current_enrollment_count - enrollment_data[-(i + 1)]['count']
self.assertSummaryPointValueEquals(stat_type, value)
# Check value of summary box for last week
i = 7
stat_type = 'enrollment_change_last_%s_days' % i
value = current_enrollment_count - enrollment_data[-(i + 1)]['count']
self.assertSummaryPointValueEquals(stat_type, value)
# Verify *something* rendered where the graph should be. We cannot easily verify what rendered
self.assertElementHasContent("[data-section=enrollment-basics] #enrollment-trend-view")
......
......@@ -131,9 +131,7 @@ class CourseEnrollmentPresenter(BasePresenter):
data = {
'date': None,
'current_enrollment': None,
'enrollment_change_last_1_days': None,
'enrollment_change_last_7_days': None,
'enrollment_change_last_30_days': None,
}
# Get most-recent enrollment
......@@ -158,12 +156,12 @@ class CourseEnrollmentPresenter(BasePresenter):
# the loop below.
num_days_of_data = len(last_month_enrollment)
# Get enrollment differentials between today for yesterday, a week ago, and a month ago
for interval in [1, 7, 30]:
count = None
if num_days_of_data > interval:
index = -interval - 1
count = current_enrollment - last_month_enrollment[index]['count']
data['enrollment_change_last_%s_days' % interval] = count
# Get difference in enrollment for last week
interval = 7
count = None
if num_days_of_data > interval:
index = -interval - 1
count = current_enrollment - last_month_enrollment[index]['count']
data['enrollment_change_last_%s_days' % interval] = count
return data
......@@ -54,23 +54,11 @@ Individual course-centric enrollment activity view.
{% include "summary_point.html" with count=summary.current_enrollment label=label tooltip=tooltips.current_enrollment only %}
</div>
<div class="col-xs-12 col-sm-3" data-stat-type="enrollment_change_last_1_days">
{% comment %}Translators: This is a sub-heading used to specify the change in student enrollment compared to the previous day.{% endcomment %}
{% captureas label %}&#916; {% trans "Previous Day" %}{% endcaptureas %}
{% include "summary_point.html" with count=summary.enrollment_change_last_1_days label=label tooltip=tooltips.enrollment_change_last_1_days only %}
</div>
<div class="col-xs-12 col-sm-3" data-stat-type="enrollment_change_last_7_days">
{% comment %}Translators: This is a sub-heading used to specify the change in student enrollment compared to the previous week.{% endcomment %}
{% captureas label %}&#916; {% trans "Previous Week" %}{% endcaptureas %}
{% include "summary_point.html" with count=summary.enrollment_change_last_7_days label=label tooltip=tooltips.enrollment_change_last_7_days only %}
</div>
<div class="col-xs-12 col-sm-3" data-stat-type="enrollment_change_last_30_days">
{% comment %}Translators: This is a sub-heading used to specify the change in student enrollment compared to the previous month.{% endcomment %}
{% captureas label %}&#916; {% trans "Previous Month" %}{% endcaptureas %}
{% include "summary_point.html" with count=summary.enrollment_change_last_30_days label=label tooltip=tooltips.enrollment_change_last_30_days only %}
</div>
</div>
</div>
......
......@@ -81,9 +81,7 @@ class CourseEnrollmentPresenterTests(TestCase):
expected = {
'date': None,
'current_enrollment': None,
'enrollment_change_last_1_days': None,
'enrollment_change_last_7_days': None,
'enrollment_change_last_30_days': None,
}
self.assertDictEqual(actual, expected)
......
......@@ -231,9 +231,7 @@ class CourseEnrollmentActivityViewTests(CourseEnrollmentViewTestMixin, TestCase)
# check to make sure that we have tooltips
expected = {
'current_enrollment': 'Students enrolled in course.',
'enrollment_change_last_1_days': 'Change in enrollment for the last full day (00:00-23:59 UTC).',
'enrollment_change_last_7_days': 'Change in enrollment during the last 7 days (through 23:59 UTC).',
'enrollment_change_last_30_days': 'Change in enrollment during the last 30 days (through 23:59 UTC).'
}
self.assertDictEqual(context['tooltips'], expected)
......@@ -244,9 +242,7 @@ class CourseEnrollmentActivityViewTests(CourseEnrollmentViewTestMixin, TestCase)
expected = {
'date': datetime.date(year=2014, month=1, day=31),
'current_enrollment': 30,
'enrollment_change_last_1_days': 1,
'enrollment_change_last_7_days': 7,
'enrollment_change_last_30_days': 30
}
self.assertDictEqual(context['summary'], expected)
......
......@@ -27,9 +27,7 @@ def get_mock_enrollment_summary():
return {
'date': datetime.date(year=2014, month=1, day=31),
'current_enrollment': 30,
'enrollment_change_last_1_days': 1,
'enrollment_change_last_7_days': 7,
'enrollment_change_last_30_days': 30,
}
......
......@@ -270,13 +270,7 @@ class EnrollmentActivityView(EnrollmentTemplateView):
'current_enrollment': _('Students enrolled in course.'),
# Translators: Please keep this time in UTC. Do not translate it into another timezone.
'enrollment_change_last_1_days': _('Change in enrollment for the last full day (00:00-23:59 UTC).'),
# Translators: Please keep this time in UTC. Do not translate it into another timezone.
'enrollment_change_last_7_days': _('Change in enrollment during the last 7 days (through 23:59 UTC).'),
# Translators: Please keep this time in UTC. Do not translate it into another timezone.
'enrollment_change_last_30_days': _('Change in enrollment during the last 30 days (through 23:59 UTC).')
'enrollment_change_last_7_days': _('Change in enrollment during the last 7 days (through 23:59 UTC).')
}
presenter = CourseEnrollmentPresenter(self.course_id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment