Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-17284 Add Olli's new quiz editing UI to Moodle 2.0
  3. MDL-17416

Clean up quiz layouts with extra page breaks for usage in a quiz attempt and other uses



    • Sub-task
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.0
    • 2.0
    • Quiz
    • None
    • Moderate


      Add to appropriate places checks if a quiz has consecutive page breaks (attempt.php etc.) or page breaks at the beginning of quiz and clean them up before use.


      I remember discussing this before with you but am not still sure how to solve it. I would appreaciate the regexp you used to find the places that need to be changed.

      I added a parameter $removeemptypages to function quiz_clean_layout($layout,$removeemptypages=false).

      This is now being called from quiz_create_attempt() ($attempt->layout = quiz_clean_layout($quiz->questions,true), but I am not sure where else it should be checked. Tim, my search of $quiz->questions returns over 200 hits - what was your grep like when you checked for possible places that needed a change?

        • also related: if $questions is empty when $quiz->questions is not, should not produce a fatal error like it does now, since the situation where a quiz has only empty pages is entirely possible
        • I am unsure about the tests in the quiz question listing for edit.php which test for both $questions and $quiz->questions before showing the exam. I removed the test for $questions, but I am not sure of the implications - why did you do this in the first place?
          **Tim Hunt> I think you might be better leaving this until after you have merged to moodle 2.0 / I have completely changed the code that is run when a quiz attempt is started in MOodle 2.0 / And I think in HEAD there is one sensible place to remove duplicate page breaks. / Look at http://cvs.moodle.org/moodle/mod/quiz/startattempt.php?view=markup / You can either put the check there, or in the quiz_create_attempt method.
          **Olli Savolainen> but I understood that when you grepped moodle's code, there were other places where this has to be done, too?
          **Tim Hunt> Ah, maybe in the quiz reports. I don't remember the details now.




            timhunt Tim Hunt
            pilpi Olli Savolainen
            Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            0 Vote for this issue
            0 Start watching this issue