some of your plugin logic can be improved.
For example, requests to the DB. I found some requests to DB in a loop. This can be improved by preparing data in collections/array and then bulk insert/update records.
In this specific example, you can retrieve all questions in one request and all questions options in another request - and then prepare data to insert/delete.
Hello,
some of your plugin logic can be improved. For example, requests to the DB. I found some requests to DB in a loop. This can be improved by preparing data in collections/array and then bulk insert/update records.
In this specific example, you can retrieve all questions in one request and all questions options in another request - and then prepare data to insert/delete.
In addition, you can use some bulk insert DB methods, like https://moodledev.io/docs/4.5/apis/core/dml#insert_records And wrap this all in a transaction: https://moodledev.io/docs/4.5/apis/core/dml#delegated-transactions
Thanks