Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -66,9 +66,9 @@ def finish_oauth(): ...@@ -66,9 +66,9 @@ def finish_oauth():
for course in l2pget('viewAllCourseInfo', token['access_token'])['dataSet']: for course in l2pget('viewAllCourseInfo', token['access_token'])['dataSet']:
session['l2p_courses'].append(course['uniqueid']) session['l2p_courses'].append(course['uniqueid'])
elif session['oauthscope'] == 'moodle': elif session['oauthscope'] == 'moodle':
session['moodle_courses'] = []
data = moodleget('getmyenrolledcourses', token['access_token']) data = moodleget('getmyenrolledcourses', token['access_token'])
if data and data.get('Data'): if data and data.get('Data'):
session['moodle_courses'] = []
for course in data['Data']: for course in data['Data']:
session['moodle_courses'].append(str(course['id'])) session['moodle_courses'].append(str(course['id']))
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment