studentquiz / moodle-mod_studentquiz

Moodle-Plugin
GNU General Public License v3.0
38 stars 37 forks source link

StudentQuiz: add completion criteria #604186 #462

Closed danghieu1407 closed 9 months ago

danghieu1407 commented 1 year ago

Hi @timhunt ,

I wanted to let you know about some recent updates to this ticket regarding completion criteria. The changes include the introduction of completion points, completion question publishing, and completion question approval.

Here's an overview of the steps I took to implement these changes:

  1. I incorporated new fields into the database.
  2. I enabled the features FEATURE_COMPLETION_HAS_RULES and FEATURE_COMPLETION_TRACK_VIEW.
  3. I integrated the function studentquiz_get_coursemodule_info into lib.php.
  4. Custom completion logic was introduced in classes/completion/custom_completion.php, mod_form.php, and lang/en/studentquiz.php.
  5. I extended the state update not only for the current user but also for users impacted by the studentquiz points. This involved modifications to reportlib.php.
  6. I ensured state updates for users in various scenarios:
    • Creating new questions (classes/observer.php)
    • Rating questions (save.php)
    • Attempting questions (attempt.php)
    • Changing question state (classes/external/update_question_state.php)
  7. Additionally, I carried out testing for the custom completion using tests/custom_completion_test.php and tests/behat/custom_completion.feature.

I would greatly appreciate it if you could take a moment to review these changes. Many thanks.

timhunt commented 9 months ago

I have now merged this, with some tidy-up: https://github.com/studentquiz/moodle-mod_studentquiz/commit/b478a7dfa2eeabcd302384185c8095f6a254dcbb. (I don't know why GitHub does not see that it is merged, perhaps because I repbased it. Anway.)