Skip to content

Commit f646293

Browse files
committed
Check for None instead
1 parent 1ea499a commit f646293

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

LearningAPI/views/foundations.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ def create_entry(pk, exercise, request, user_id):
3939
"""
4040
cohort = request.data.get('cohort', "Unassigned")
4141

42+
if cohort != None:
43+
# Possible values are a string that starts with 'd' for day cohorts or 'e' for evening cohorts
44+
# followed by a number representing the cohort number
45+
# Convert 'd' into 'Day ' and 'e' into 'Evening '
46+
if cohort.startswith('d'):
47+
cohort = 'Day ' + cohort[1:]
48+
elif cohort.startswith('e'):
49+
cohort = 'Evening ' + cohort[1:]
50+
4251
exercise.cohort = cohort
4352
exercise.slug = pk
4453
exercise.attempts = request.data.get('attempts', 0)

0 commit comments

Comments
 (0)