diff options
author | Nao Pross <np@0hm.ch> | 2021-02-12 01:31:01 +0100 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2021-02-12 01:31:01 +0100 |
commit | a9007a546964009dc2979a96b75d02291e4130b5 (patch) | |
tree | 89fb47beb98ed998364ad62244dc150091614ebd /muddle | |
parent | Partially refractor muddle.moodle and add test (diff) | |
download | Muddle-a9007a546964009dc2979a96b75d02291e4130b5.tar.gz Muddle-a9007a546964009dc2979a96b75d02291e4130b5.zip |
Continue refractor of muddle.moodle
Diffstat (limited to '')
-rw-r--r-- | muddle/moodle.py | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/muddle/moodle.py b/muddle/moodle.py index a9209d7..8146fd4 100644 --- a/muddle/moodle.py +++ b/muddle/moodle.py @@ -104,10 +104,10 @@ class Course(SchemaObj): def get_sections(self, api): req = api.core_course_get_contents(courseid=self.id) - for sec in req.json(): + for s in req.json(): # rest api response does not contain course id - sec["course"] = self.id - yield Section._fromdict(sec) + s["course"] = self.id + yield Section._fromdict(s) @dataclasses.dataclass @@ -122,8 +122,13 @@ class Section(SchemaObj): name: str summary: str visible: bool + modules: List + def get_modules(self): + for m in self.modules: + yield Module._fromdict(m) + @dataclasses.dataclass class Module(SchemaObj): @@ -132,16 +137,23 @@ class Module(SchemaObj): https://www.examulator.com/er/output/tables/course_modules.html """ id: int - course: int - module: int - section: int + name: str + + +@dataclasses.dataclass +class File(SchemaObj): + filename: str + fileurl: str @dataclasses.dataclass class Folder(SchemaObj): - """ - Resource type that holds files - """ + pass + + +@dataclasses.dataclass +class ExternalLink(SchemaObj): + pass class ApiHelper: |