wooclap / moodle-mod_wooclap

Moodle plugin for Wooclap (https://www.wooclap.com/).
2 stars 5 forks source link

Moodle v4: allow creating a Wooclap activity from an existing Moodle quiz #15

Closed dfdeagle47 closed 2 years ago

dfdeagle47 commented 2 years ago

The Moodle plugin for Wooclap almost fully works on Moodle v4.

The only feature which does not work yet is the ability of creating a new Wooclap activity from an existing Moodle quiz.

We have isolated the issue to these lines:

https://github.com/wooclap/moodle-mod_wooclap/blob/master/lib.php#L620-L630=

The problem comes from the fact that Moodle v4 changes the database structure quite a bit for quizzes and questions:

https://github.com/moodle/moodle/blob/master/mod/quiz/upgrade.txt#L13-L20=

https://github.com/moodle/moodle/blob/master/question/upgrade.txt#L3-L20=

We need to update the database queries to make it work again (while keeping it backwards-compatible).

We're currently investigating this issue.

lucaboesch commented 2 years ago

Thanks for enquiring, @dfdeagle47. Also, you should include a monologo.svg icon and a purpose in the lib.php wooclap_supports() function for the Moodle 4.0 plugin.

dfdeagle47 commented 2 years ago

We're making some progress to adapt the queries to fetch the questions.

It's very unfortunate that the documentation does not seem to be complete for Moodle v4 (https://docs.moodle.org/dev/Question_API):

Also, the documentation is currently in a bit of a mess

There is no database schema for Moodle v4 available at the moment (https://docs.moodle.org/dev/Database_Schema) which is quite surprising since there are significant structure changes to the schema.

We have to reverse engineer our way into the new structure by looking at the database tables, and the few comments we find here and there.

Reverse-engineering the database is complicated by the fact that there's no foreign key contraints within the database (https://moodle.org/mod/forum/discuss.php?d=74062), which makes usual database visual tools useless.

Overall, a bit of a frustrating developer experience at the moment on our end as we're lacking useful information from Moodle (or we missed it?), but we'll find a solution.


Nevertheless, we think we have found the right query. We'll perform more testing next week and if everything seems to work, we'll be able to make a new release of your plugin.

(Internal tracking: https://github.com/wooclap/wooclap-moodle-mod/pull/20)


Thanks for enquiring, @dfdeagle47. Also, you should include a monologo.svg icon and a purpose in the lib.php wooclap_supports() function for the Moodle 4.0 plugin.

Thank you for the insight. We'll take a look at this as well.

dfdeagle47 commented 2 years ago

I found this which will help us out (https://moodle.org/mod/forum/discuss.php?d=417599#p1685143):

image

dfdeagle47 commented 2 years ago

Should be fixed via https://github.com/wooclap/moodle-mod_wooclap/releases/tag/2022061600.