lib.moodle_get_parsers¶
This file contains all parsers that parse information from Moodle API calls.
Module Contents¶
-
lib.moodle_get_parsers.parse_enrolled_students(enrolled_users)¶ Parse the statements containing all enrolled students of a course.
- Parameters
enrolled_users (list(dict(str, int))) – A json statement, received as response on a Moodle call.
- Returns
A list of the ids of the enrolled students.
- Return type
list(str)
-
lib.moodle_get_parsers.parse_course_info(course)¶ Parse information of a course that is retrieved from Moodle.
- Parameters
course (dict(str, list(dict(str, int)))) – A json statement, received as response on a Moodle call.
- Returns
The name of a course.
- Return type
str
-
lib.moodle_get_parsers.parse_courses(courses)¶ Parse information of all courses that are retrieved from Moodle.
- Parameters
courses (list(dict(str, int))) – Statements for all courses.
- Returns
A dictionary containing the names and ids of all courses.
- Return type
list(dict(str, int))
-
lib.moodle_get_parsers.parse_assignment_list(assignments)¶ Parse all assignments of a course from a statement received from Moodle.
- Parameters
assignments (dict(str, list(dict(str, int)))) – A statement containing all assignments of a course.
- Returns
A dictionary of all assignments of a course.
- Return type
list(dict(str, int))
-
lib.moodle_get_parsers.parse_single_assignment(assignment)¶ Parse the useful information from a single assignment.
- Parameters
assignment (dict(str, str)) – All information of a single assignment.
- Returns
The id, due_date and name of an assignment.
- Return type
tuple(int, int, str)
-
lib.moodle_get_parsers.parse_get_course_contents(course_contents, courseId)¶ Extract used course contents for a specific course.
Extract only needed course contents. Ignore contents of module type forum, lti, feedback, workshop, data, chat, survey or glossary. Return the other contents in a dictionary.
- Parameters
course_contents (list(dict(str, int))) – All contents of a course.
courseId (int) – The id of the course the contents are from.
- Returns
A list of dictionaries. Each dictionary contains a course id, module name, target, type and external id.
- Return type
list(dict(str, int))
-
lib.moodle_get_parsers.parse_get_teachers(courses)¶ Parse the teacher information received from Moodle.
- Parameters
courses (list(dict(str, int))) – All information about all courses in Moodle.
- Returns
A list of dictionaries containing all user information and the course they are teacher from.
- Return type
dict(int, dict(str, str))