Skip to content

Refactor whole Quiz Module

Anton Ballmaier requested to merge vue-quiz into master

Closes #1666

What does this MR do?

Refactors all quiz related functionality. The main functionality stays the same, but lots of really old bugs are fixed, XHR is replaced by API and PHP view classes by Vue.

This includes largely:

  • Answering quizzes
  • Editing quizzes
  • Viewing and deleting sessions for orgas

How confident are you it won't break things if deployed?

Quiz sessions started in the prod version cannot be continued in beta and vise versa. The data about finished sessions is compatible. This changes a lot. There will be some new bugs for sure. But I tried hard to eliminate sources of mistakes:

  • I wrote lots of tests
  • I tested the functionality extensively by hand.
  • This MR is already the second version of me refactoring the quiz module. Therefor, I already solved some mistakes I did the first time.

Goals of this MR:

There are some places where we need to add new quizzes in the future. The Quiz code was ancient and convoluted, and this MR is supposed to allow to add quizzes for other countries / languages as well as new Roles / Achievements (HACCP, KAM etc.) in the future.

Notice for Merge:

  • Beta:

    • Run migration
    • Set questions_untimed to 20 for foodsaver quiz (id=1)

    UPDATE `fs_quiz` SET `questcount_untimed` = '20' WHERE `fs_quiz`.`id` = 1;

  • Full merge:

    • Remove all currently running sessions (because they are no longer compatible)
    • Remove all saved results of old sessions (because they cannot be read, and would be deleted after 2 weeks anyway).

    DELETE FROM fs_quiz_session WHERE `status` = 0; UPDATE fs_quiz_session SET quiz_result = NULL, quiz_questions = NULL;

Screenshots (if applicable)

Click to expand

Screenshot_from_2024-02-10_20-56-25

Screenshot_from_2024-02-10_20-56-55

Screenshot_from_2024-02-10_20-57-39

Screenshot_from_2024-02-10_20-58-04

Screenshot_from_2024-02-10_20-58-28

Screenshot_from_2024-02-10_20-58-56

Screenshot_from_2024-02-10_20-59-16

Screenshot_from_2024-02-10_21-11-35

Screenshot_from_2024-02-10_21-13-42

Screenshot_from_2024-02-10_21-15-10

Screenshot_from_2024-02-10_21-17-19

Screenshot_from_2024-02-10_21-18-04

Screenshot_from_2024-02-10_21-18-24

Screenshot_from_2024-02-10_21-18-54

Screenshot_from_2024-02-10_21-19-02

Screenshot_from_2024-02-10_21-19-17

Screenshot_from_2024-02-10_21-20-25

Screenshot_from_2024-02-10_21-24-21

Screenshot_from_2024-02-10_21-24-31

Checklist

  • added a test, or explain why one is not needed/possible...
  • no unrelated changes
  • asked someone for a code review
  • set a "for:" label to indicate who will be affected by this change
  • added to the next milestone (see https://gitlab.com/foodsharing-dev/foodsharing/-/milestones, unless it has a "for:Dev" label)
  • added an entry to CHANGELOG.md
  • added a short text in the release notes to /release-notes/YYYY-MM.md
  • Once your MR has been merged, you are responsible to create a testing issue in the Beta Testing forum: https://foodsharing.de/region?bid=734&sub=forum. Please change the MRs label to "state:Beta testing".
    • Consider writing a detailed description in German.
    • Describe in a few sentences, what should be tested from a user perspective.
    • Also mention different settings (e.g. different browsers, roles, ...) how this change can be tested.
    • Be aware, that also non technical people should understand.
Edited by Anton Ballmaier

Merge request reports