Romern / syncMyMoodle

Synchronization client for RWTH Moodle
GNU General Public License v3.0
72 stars 18 forks source link

Sync is breaking when links are not available #19

Closed StopMotionCuber closed 3 years ago

StopMotionCuber commented 3 years ago

Hi,

thanks for this project, I really appreciate this as this includes an easy way to sync Moodle, especially OpenCast videos.

However, I'm having an issue with not-available links, which is immediately breaking the sync operation for a certain course.

Traceback:

Traceback (most recent call last):
  File "./syncMyMoodle.py", line 217, in sync
    ass = [a for a in assignments["assignments"] if a["cmid"] == module["id"]][0]
IndexError: list index out of range

The error message is:

Failed to download the module {'id': 402297, 'url': 'https://moodle.rwth-aachen.de/mod/assign/view.php?id=402297', 'name': 'Sheet 4', 'instance': 14711, 'visible': 1, 'uservisible': False, 'availabilityinfo': 'Verfügbar ab <strong>25. November 2020, 10:00</strong>', 'visibleoncoursepage': 1, 'modicon': 'https://moodle.rwth-aachen.de/theme/image.php/boost_campus_rwth/assign/1605681862/icon', 'modname': 'assign', 'modplural': 'Aufgaben', 'indent': 0, 'onclick': '', 'afterlink': None, 'customdata': '""', 'noviewlink': False, 'completion': 1, 'completiondata': {'state': 0, 'timecompleted': 0, 'overrideby': None, 'valueused': False}}: list index out of range
Romern commented 3 years ago

I fixed it in https://github.com/Romern/syncMyMoodle/commit/7e4b838faec8db4686e9d9e84d4ac7e8fdfefae1. It is weird though, because if there is an assignment module in the course, it should have been retrived earlier. Is Sheet 4 somewhat special in that it does not contain any data yet or similar?
Could you post the output of the syncing using the branch print_assignment (redact sensitive data if it is contained, e.g. submissions)?

StopMotionCuber commented 3 years ago

The output is rather verbose and I would rather like to not scan it for sensitive information. Sheet 4 did not appear in the output.

But, yes, this assignment is special as it will only be available in the future, see the attached picture: image

The last commit fixed the issue, thanks for the fast response