Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-73778

Error in Oracle with "Manual grading settings are remembered as user preferences" scenario

XMLWordPrintable

      After integrating MDL-71696, we started getting the following Oracle failure: https://ci.moodle.org/job/W.02.05%20-%20Behat%20-%20Goutte%20+%20Oracle/1590/

      001 Scenario: Manual grading settings are remembered as user preferences # /var/www/html/mod/quiz/report/grading/tests/behat/grading.feature:80
            And I press "Change options"                                       # /var/www/html/mod/quiz/report/grading/tests/behat/grading.feature:90
              Moodle exception: Error reading from databaseMore information about this error
              
              Error reading from database
              More information about this error
              
              
                  
              ×
                  
              Debug info: 
               ORA-00979: not a GROUP BY expression
              SELECT
                  qa.questionusageid,
                  1
              FROM b1quiz_attempts quiza  
                              JOIN b1question_attempts qa ON qa.questionusageid = quiza.uniqueid
              JOIN b1question_attempt_steps qas ON qas.questionattemptid = qa.id
                      AND qas.sequencenumber = (
                              SELECT MAX(sequencenumber)
                              FROM b1question_attempt_steps
                              WHERE questionattemptid = qa.id
                          )
              JOIN b1question q ON q.id = qa.questionid
              WHERE
                  quiza.quiz = :o_mangrquizid AND
                              quiza.preview = 0 AND
                              quiza.state = :o_statefinished AND
                  qa.slot = :o_slot
                   AND qa.questionid = :o_questionid AND qas.state IN (:o_summarystates25,:o_summarystates26,:o_summarystates27,:o_summarystates28,:o_summarystates29)
              ORDER BY (
                                  SELECT MAX(sortqas.timecreated)
                                  FROM b1question_attempt_steps sortqas
                                  WHERE sortqas.questionattemptid = qa.id
                                      AND sortqas.state NOT IN (:o_mangrstate20,:o_mangrstate21,:o_mangrstate22,:o_mangrstate23,:o_mangrstate24)
                                  )
                      
              [array (
                'o_mangrquizid' => '1',
                'o_statefinished' => 'finished',
                'o_slot' => 1,
                'o_questionid' => 1,
                'o_summarystates25' => 'finished',
                'o_summarystates26' => 'gaveup',
                'o_summarystates27' => 'gradedwrong',
                'o_summarystates28' => 'gradedpartial',
                'o_summarystates29' => 'gradedright',
                'o_mangrstate20' => 'manfinished',
                'o_mangrstate21' => 'mangaveup',
                'o_mangrstate22' => 'mangrwrong',
                'o_mangrstate23' => 'mangrpartial',
                'o_mangrstate24' => 'mangrright',
              )]
              Error code: dmlreadexception
               (Exception)
      

       

      Eloy and I have been trying to find a patch for fixing it and these are our findings:

      • In get_usage_ids_where_question_in_state() in mod/quiz/report/grading/report.php, there is a $orderby when "Date" is selected that we don't understand (it has been there for ages, so seems unrelated to the patch, but it seems the origin of the error). It makes zero sense to ORDER BY number: http://sqlfiddle.com/#!4/9e8732/1 . Eloy prepare it and was expecting that if it returned 1, then it was equivalent to ORDER BY id, and if it returned 2, then ORDER BY name... timhunt could you please take a look at it?
      • If this $orderby weird SQL query is replaced to $orderby = 'qa.timemodified DESC';  the behat test passes (looking at the tables and the whole SQL query, that's what I was expected to have in the ORDER BY query).
      • The SQL query seems to be working when placeholders are replaced by values... but behat (and also manual tests simulating this scenario), keep failing...

       

            safatshahin Safat Shahin
            sarjona Sara Arjona (@sarjona)
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 5 minutes
                1h 5m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.