Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #175 from edx/demographics-help
Browse files Browse the repository at this point in the history
Added Contextual Help to the Demographics Pages
  • Loading branch information
clintonb committed Oct 28, 2014
2 parents 5163258 + 8287b77 commit e671f30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 9 additions & 4 deletions acceptance_tests/test_course_enrollment_demographics.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


class CourseEnrollmentDemographicsAgeTests(CourseDemographicsPageTestsMixin, WebAppTest):
help_path = 'enrollment/Demographics_Age.html'

demographic_type = demographic.BIRTH_YEAR
table_columns = ['Age', 'Total Enrollment', 'Percent of Total']
Expand All @@ -21,7 +22,7 @@ def setUp(self):
self.page = CourseEnrollmentDemographicsAgePage(self.browser)
self.course = self.api_client.courses(self.page.course_id)
self.demographic_data = sorted(self.course.enrollment(self.demographic_type),
key=lambda item: item['count'], reverse=True)
key=lambda item: item['count'], reverse=True)

def test_page(self):
super(CourseEnrollmentDemographicsAgeTests, self).test_page()
Expand Down Expand Up @@ -101,7 +102,9 @@ def _test_table_row(self, datum, column, sum_count):
self.assertIn('text-right', column[1].get_attribute('class'))
self.assertIn('text-right', column[2].get_attribute('class'))


class CourseEnrollmentDemographicsGenderTests(CourseDemographicsPageTestsMixin, WebAppTest):
help_path = 'enrollment/Demographics_Gender.html'

demographic_type = demographic.GENDER
table_columns = ['Date', 'Total Enrollment', 'Female', 'Male', 'Other', 'Not Reported']
Expand All @@ -114,7 +117,8 @@ def setUp(self):
end_date = datetime.datetime.utcnow()
end_date_string = end_date.strftime(self.api_client.DATE_FORMAT)
response = self.course.enrollment(self.demographic_type, end_date=end_date_string)
self.demographic_data = sorted(response, key=lambda x: datetime.datetime.strptime(x['date'], '%Y-%m-%d'), reverse=True)
self.demographic_data = sorted(response, key=lambda x: datetime.datetime.strptime(x['date'], '%Y-%m-%d'),
reverse=True)

def _test_table_row(self, datum, column, sum_count):
expected_date = datetime.datetime.strptime(datum['date'], self.api_date_format).strftime(
Expand All @@ -125,11 +129,12 @@ def _test_table_row(self, datum, column, sum_count):
unicode(datum.get('male', 0)), unicode(datum.get('other', 0)), unicode(datum.get('u', 0))]
actual = [column[0].text, column[1].text, column[2].text, column[3].text, column[4].text, column[5].text]
self.assertListEqual(actual, expected)
for i in range(1,6):
for i in range(1, 6):
self.assertIn('text-right', column[i].get_attribute('class'))


class CourseEnrollmentDemographicsEducationTests(CourseDemographicsPageTestsMixin, WebAppTest):
help_path = 'enrollment/Demographics_Education.html'

demographic_type = demographic.EDUCATION
table_columns = ['Educational Background', 'Total Enrollment']
Expand All @@ -139,7 +144,7 @@ def setUp(self):
self.page = CourseEnrollmentDemographicsEducationPage(self.browser)
self.course = self.api_client.courses(self.page.course_id)
self.demographic_data = sorted(self.course.enrollment(self.demographic_type),
key=lambda item: item['count'], reverse=True)
key=lambda item: item['count'], reverse=True)

def test_page(self):
super(CourseEnrollmentDemographicsEducationTests, self).test_page()
Expand Down
3 changes: 3 additions & 0 deletions docs/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ default = index.html
enrollment_activity = enrollment/Enrollment_Activity.html
enrollment_geography = enrollment/Enrollment_Geography.html
engagement_content = engagement/Engagement_Content.html
enrollment_demographics_age = enrollment/Demographics_Age.html
enrollment_demographics_education = enrollment/Demographics_Education.html
enrollment_demographics_gender = enrollment/Demographics_Gender.html

# below are the language directory names for the different locales
[locales]
Expand Down

0 comments on commit e671f30

Please sign in to comment.