Skip to content

Commit

Permalink
handled multiple urls
Browse files Browse the repository at this point in the history
  • Loading branch information
venkata-s123 authored Jan 3, 2025
1 parent f851faf commit b301294
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions common/djangoapps/student/views/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -1296,9 +1296,12 @@ def merge_grades(responses):
@login_required
def attendance_report(request):
try:
moodle_base_url = configuration_helpers.get_value("MOODLE_URL", "")
multiple_base_url = configuration_helpers.get_value("MULTIPLE_MOODLE_URLS", "")
moodle_service_url = moodle_base_url + "/webservice/rest/server.php"
multiple_moodle = configuration_helpers.get_value("MULTIPLE_MOODLE", False)
if multiple_moodle:
moodle_base_url = configuration_helpers.get_value("MULTIPLE_MOODLE_URLS","")
else:
moodle_base_url = [configuration_helpers.get_value("MOODLE_URL", "")]

moodle_wstoken = configuration_helpers.get_value("MOODLE_TOKEN", "")
course_attendance_function = "mod_wsattendance_get_attendance"
if "site" in request.GET:
Expand All @@ -1309,7 +1312,7 @@ def attendance_report(request):
querystring = {"wstoken" : moodle_wstoken, "wsfunction" : course_attendance_function, "moodlewsrestformat" : "json", "user_email":request.user.email, "site_name" : site }

responses = {}
for index_no,api_url in enumerate(multiple_base_url):
for index_no,api_url in enumerate(moodle_base_url):

moodle_service_url = api_url + "/webservice/rest/server.php"
response = requests.request("POST", moodle_service_url, headers = headers, params = querystring)
Expand Down

0 comments on commit b301294

Please sign in to comment.