Skip to content

Commit

Permalink
Merge pull request openedx-unsupported#125 from edx/enrollment-track-…
Browse files Browse the repository at this point in the history
…switch

Enrollment tracks: add credit, do not merge audit & honor
  • Loading branch information
thallada committed Jul 7, 2016
2 parents b165ff0 + eb682ed commit f6a4eb3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
3 changes: 2 additions & 1 deletion analytics_data_api/constants/enrollment_modes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
AUDIT = u'audit'
CREDIT = u'credit'
HONOR = u'honor'
PROFESSIONAL = u'professional'
PROFESSIONAL_NO_ID = u'no-id-professional'
VERIFIED = u'verified'

ALL = [AUDIT, HONOR, PROFESSIONAL, PROFESSIONAL_NO_ID, VERIFIED]
ALL = [AUDIT, CREDIT, HONOR, PROFESSIONAL, PROFESSIONAL_NO_ID, VERIFIED]
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ def generate_daily_data(self, course_id, start_date, end_date):

enrollment_mode_ratios = {
'audit': 0.15,
'honor': 0.35,
'credit': 0.15,
'honor': 0.25,
'professional': 0.10,
'verified': 0.40
'verified': 0.35
}

# Generate birth year ratios
Expand Down Expand Up @@ -255,7 +256,7 @@ def handle(self, *args, **options):
username = options['username']
video_id = '0fac49ba'
video_module_id = 'i4x-edX-DemoX-video-5c90cffecd9b48b188cbfea176bf7fe9'
start_date = datetime.datetime(year=2015, month=1, day=1, tzinfo=timezone.utc)
start_date = datetime.datetime(year=2016, month=1, day=1, tzinfo=timezone.utc)

num_weeks = options['num_weeks']
if num_weeks:
Expand Down
5 changes: 3 additions & 2 deletions analytics_data_api/v0/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
from analytics_data_api.v0 import models


# Below are the enrollment modes supported by this API. The audit and honor enrollment modes are merged into honor.
ENROLLMENT_MODES = [enrollment_modes.HONOR, enrollment_modes.PROFESSIONAL, enrollment_modes.VERIFIED]
# Below are the enrollment modes supported by this API.
ENROLLMENT_MODES = [enrollment_modes.AUDIT, enrollment_modes.CREDIT, enrollment_modes.HONOR,
enrollment_modes.PROFESSIONAL, enrollment_modes.VERIFIED]


class CourseActivityByWeekSerializer(serializers.ModelSerializer):
Expand Down
9 changes: 0 additions & 9 deletions analytics_data_api/v0/tests/views/test_courses.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,6 @@ def generate_data(self, course_id=None):
G(self.model, course_id=course_id, date=self.date, mode=mode)

def serialize_enrollment(self, enrollment):
# Treat audit as honor
if enrollment.mode is enrollment_modes.AUDIT:
enrollment.mode = enrollment_modes.HONOR

return {
u'course_id': enrollment.course_id,
u'date': enrollment.date.strftime(settings.DATE_FORMAT),
Expand All @@ -432,10 +428,6 @@ def format_as_response(self, *args):
cumulative += ce.cumulative_count
response[ce.mode] = ce.count

# Merge the honor and audit modes
response[enrollment_modes.HONOR] += response[enrollment_modes.AUDIT]
del response[enrollment_modes.AUDIT]

response[enrollment_modes.PROFESSIONAL] += response[enrollment_modes.PROFESSIONAL_NO_ID]
del response[enrollment_modes.PROFESSIONAL_NO_ID]

Expand All @@ -453,7 +445,6 @@ def test_default_fill(self):

# Create the expected data
modes = list(enrollment_modes.ALL)
modes.remove(enrollment_modes.AUDIT)
modes.remove(enrollment_modes.PROFESSIONAL_NO_ID)

expected = {}
Expand Down
3 changes: 0 additions & 3 deletions analytics_data_api/v0/views/courses.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,6 @@ def get_queryset(self):
total += enrollment.count
cumulative_total += enrollment.cumulative_count

# Merge audit and honor
item[enrollment_modes.HONOR] = item.get(enrollment_modes.HONOR, 0) + item.pop(enrollment_modes.AUDIT, 0)

# Merge professional with non verified professional
item[enrollment_modes.PROFESSIONAL] = \
item.get(enrollment_modes.PROFESSIONAL, 0) + item.pop(enrollment_modes.PROFESSIONAL_NO_ID, 0)
Expand Down

0 comments on commit f6a4eb3

Please sign in to comment.