Question order not consistent

Created on 2 February 2023, over 1 year ago
Updated 9 February 2023, over 1 year ago

Problem/Motivation

When taking a quiz, the order of the questions are not consistent.

This is because when a quiz result is first created, it only sorts questions based on the "weight" field, which is always zero unless the user has manually dragged the questions around on the page, or set the question weight manually.

If you already have results in a quiz, you cannot easily go back and set the weights, either, because this page does not let you edit the order of existing quizzes.

Steps to reproduce

  1. Create a quiz.
  2. Create several questions, and put a number in the description. DO NOT DRAG THE ORDER OF THE QUESTIONS ON THE PAGE.
  3. Take the quiz multiple times. The questions sometimes come up with incorrect ordering.

Proposed resolution

Add another sort order to the query that loads up the questions for a new quiz.

Remaining tasks

Create patch.

User interface changes

None.

API changes

None.

Data model changes

It might be useful to sort questions by title -- but sorting by question id matches what happens in the editing interface.

πŸ› Bug report
Status

Needs review

Version

6.0

Component

Code - Quiz core

Created by

πŸ‡ΊπŸ‡ΈUnited States freelock Seattle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @freelock
  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States freelock Seattle

    Patch attached.

  • πŸ‡ΊπŸ‡ΈUnited States djdevin

    This was supposed to be fixed in #3206862: Quiz Pages not working β†’

    I can't seem to reproduce this, adding a question always increments the weight, either from the questions form or the question bank. I didn't even touch the questions form and the order in the database is correct.

    In Quiz::addQuestion we have code to increment the weight whenever a question is added.

  • πŸ‡ΊπŸ‡ΈUnited States djdevin
  • πŸ‡ΊπŸ‡ΈUnited States freelock Seattle

    Ok. I started on this project last August, and the quizzes do predate that -- a git history shows that they had quiz-6.0.0-alpha4 at that point, and I see that version predates the fix from #3206862: Quiz Pages not working β†’ .

    So I think these are just old quizzes that need to get manually re-ordered as mentioned in comment #8 on that issue...

    In any case, I wonder if the patch I supplied is worth adding, in case there are other legacy quizzes affected by this?

Production build 0.69.0 2024