Adapt flow for new 'professional' mode.

ECOM-41
This commit is contained in:
Diana Huang
2014-08-08 17:12:47 -04:00
committed by Julia Hansbrough
parent 805c325653
commit 9aa095dd21
8 changed files with 116 additions and 45 deletions

View File

@@ -112,6 +112,21 @@ class CourseMode(models.Model):
else:
return None
@classmethod
def verified_mode_for_course(cls, course_id):
"""
Since we have two separate modes that can go through the verify flow,
we want to be able to select the 'correct' verified mode for a given course.
Currently, we prefer to return the professional mode over the verified one
if both exist for the given course.
"""
modes_dict = cls.modes_for_course_dict(course_id)
verified_mode = modes_dict.get('verified', None)
professional_mode = modes_dict.get('professional', None)
# we prefer professional over verify
return professional_mode if professional_mode else verified_mode
@classmethod
def min_course_price_for_verified_for_currency(cls, course_id, currency):
"""