Unverified Commit f46c791c authored by Roman Sebastian Karwacik's avatar Roman Sebastian Karwacik
Browse files

If data is empty, the moodle_courses object should not be made, as the user...

If data is empty, the moodle_courses object should not be made, as the user should be promted to reauthenticate instead of stating that he is not in the course, which he maybe is
parent 0a030cd7
......@@ -66,9 +66,9 @@ def finish_oauth():
for course in l2pget('viewAllCourseInfo', token['access_token'])['dataSet']:
session['l2p_courses'].append(course['uniqueid'])
elif session['oauthscope'] == 'moodle':
session['moodle_courses'] = []
data = moodleget('getmyenrolledcourses', token['access_token'])
if data and data.get('Data'):
session['moodle_courses'] = []
for course in data['Data']:
session['moodle_courses'].append(str(course['id']))
else:
......
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