Skip to content

Commit

Permalink
refactored moodle base_url method
Browse files Browse the repository at this point in the history
  • Loading branch information
jabelone committed Sep 28, 2023
1 parent e2924a3 commit be8edf8
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions memberportal/services/moodle_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
import requests
import math

MOODLE_BASE_URL = config.MOODLE_API_BASE_URL
MOODLE_TOKEN = config.MOODLE_API_TOKEN

MOODLE_URL = (
MOODLE_BASE_URL
+ "/webservice/rest/server.php?wstoken="
+ MOODLE_TOKEN
+ "&moodlewsrestformat=json&wsfunction="
)


def get_moodle_url(function_name: str):
MOODLE_BASE_URL = config.MOODLE_API_BASE_URL
MOODLE_TOKEN = config.MOODLE_API_TOKEN

MOODLE_URL = (
MOODLE_BASE_URL
+ "/webservice/rest/server.php?wstoken="
+ MOODLE_TOKEN
+ "&moodlewsrestformat=json&wsfunction="
)

return MOODLE_URL + function_name


Expand Down Expand Up @@ -87,9 +87,3 @@ def moodle_get_user_from_email(user_email: str):
}

return user


# user_id = moodle_get_user_from_email("[email protected]").get("id")
# activities = moodle_get_course_activity_completion_status(2, user_id)
# print(activities["total_course_activities"])
# print(activities["percentage_completed"])

0 comments on commit be8edf8

Please sign in to comment.