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

Lesson - Email graded essays not working

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.7, 2.4.4, 2.5
    • Fix Version/s: 2.4.6, 2.5.2
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide
      1. add a Lesson activity to a course
      2. add a question page of type "essay" to the lesson
      3. as a student, submit an answer for the essay.
      4. as a teacher, go to "Grade essay" tab, and grade the students essays
      5. there should be a link called "Email ALL graded essays"
      6. clicking on "Email ALL graded essays" should not result in "Error reading from database". It should display "Emails sent successfully" instead.
      Show
      add a Lesson activity to a course add a question page of type "essay" to the lesson as a student, submit an answer for the essay. as a teacher, go to "Grade essay" tab, and grade the students essays there should be a link called "Email ALL graded essays" clicking on "Email ALL graded essays" should not result in "Error reading from database". It should display "Emails sent successfully" instead.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull Master Branch:

      Description

      Error reading from database

      More information about this error
      Debug info: Unknown column 'ui.id' in 'on clause'

      SELECT u.*
      FROM m_user u
      JOIN (
      SELECT DISTINCT userid
      FROM m_lesson_attempts
      WHERE lessonid = ?
      ) ui ON u.id = ui.id
      [array (
      0 => '2',
      )]
      Error code: dmlreadexception
      Stack trace:

      line 426 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 1023 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 166 of /mod/lesson/essay.php: call to mysqli_native_moodle_database->get_records_sql()

      Solution
      In mod/lesson/essay.php line 166:
      Change:

      ) ui ON u.id = ui.id", $params)) {

      to:

      ) ui ON u.id = ui.userid", $params)) {

        Gliffy Diagrams

          Activity

          Hide
          poltawski Dan Poltawski added a comment -

          Hi Amanda,

          The fix looks good, but could you provide some steps to reproduce this problem?

          Show
          poltawski Dan Poltawski added a comment - Hi Amanda, The fix looks good, but could you provide some steps to reproduce this problem?
          Hide
          rwijaya Rossiani Wijaya added a comment -

          Thanks for spotting that and providing a patch.

          It would be good if you could post a git patch and some testing instruction for this.

          I took a quick look at 2.3 version and noticed the error might also occurs there.

          Show
          rwijaya Rossiani Wijaya added a comment - Thanks for spotting that and providing a patch. It would be good if you could post a git patch and some testing instruction for this. I took a quick look at 2.3 version and noticed the error might also occurs there.
          Hide
          sillyxone Huy Hoang added a comment - - edited

          Testing instructions:
          1. add a Lesson assignment to a course
          2. add a question page of type "essay" to the lesson
          3. as a student, submit an answer for the essay.
          4. as a teacher, go to "Grade essay" tab, there should be a link called "Email ALL graded essays"
          5. clicking on "Email ALL graded essays" should not result in "Error reading from database". It should display "Emails sent successfully" instead.

          Show
          sillyxone Huy Hoang added a comment - - edited Testing instructions: 1. add a Lesson assignment to a course 2. add a question page of type "essay" to the lesson 3. as a student, submit an answer for the essay. 4. as a teacher, go to "Grade essay" tab, there should be a link called "Email ALL graded essays" 5. clicking on "Email ALL graded essays" should not result in "Error reading from database". It should display "Emails sent successfully" instead.
          Hide
          jmvedrine Jean-Michel Vedrine added a comment -

          In order to test part of the fix for MDL-41018, I need to repair Email graded essays first. So I created a github branch.
          I will cherry-pick to stable branches.

          Show
          jmvedrine Jean-Michel Vedrine added a comment - In order to test part of the fix for MDL-41018 , I need to repair Email graded essays first. So I created a github branch. I will cherry-pick to stable branches.
          Hide
          jmvedrine Jean-Michel Vedrine added a comment -

          Hello,
          Could somebody peer review please, I think the bug is quite trivial and I need this for another issue. Thanks.

          Show
          jmvedrine Jean-Michel Vedrine added a comment - Hello, Could somebody peer review please, I think the bug is quite trivial and I need this for another issue. Thanks.
          Hide
          rajeshtaneja Rajesh Taneja added a comment -

          Thanks for fixing this Jean-Michel,

          Patch looks good, pushing it for integration review.
          [y] Syntax
          [y] Whitespace
          [y] Output
          [-] Language
          [y] Databases
          [y] Testing
          [-] Security
          [-] Documentation
          [y] Git
          [y] Sanity check

          Show
          rajeshtaneja Rajesh Taneja added a comment - Thanks for fixing this Jean-Michel, Patch looks good, pushing it for integration review. [y] Syntax [y] Whitespace [y] Output [-] Language [y] Databases [y] Testing [-] Security [-] Documentation [y] Git [y] Sanity check
          Hide
          jmvedrine Jean-Michel Vedrine added a comment -

          Thanks Rajesh for looking at this issue so quickly.

          Show
          jmvedrine Jean-Michel Vedrine added a comment - Thanks Rajesh for looking at this issue so quickly.
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Thanks Jean-Michel - this has been integrated now.

          Show
          samhemelryk Sam Hemelryk added a comment - Thanks Jean-Michel - this has been integrated now.
          Hide
          jerome Jérôme Mouneyrac added a comment -

          Passed. Tested on master, 2.5, 2.4. Thanks guys.

          Show
          jerome Jérôme Mouneyrac added a comment - Passed. Tested on master, 2.5, 2.4. Thanks guys.
          Hide
          jmvedrine Jean-Michel Vedrine added a comment -

          Thanks Rajesh, Sam and Jerome,
          I can now continue working on MDL-41018. If I find other issues in lesson email graded essays in the process I will create another issue.

          Show
          jmvedrine Jean-Michel Vedrine added a comment - Thanks Rajesh, Sam and Jerome, I can now continue working on MDL-41018 . If I find other issues in lesson email graded essays in the process I will create another issue.
          Hide
          poltawski Dan Poltawski added a comment -

          Cảm ơn!

          Your changes have now been merged upstream in git and will be available on the Moodle download sites shortly!

          Một hai ba, yo

          Show
          poltawski Dan Poltawski added a comment - Cảm ơn! Your changes have now been merged upstream in git and will be available on the Moodle download sites shortly! Một hai ba, yo
          Hide
          sillyxone Huy Hoang added a comment -

          very funny, Dan! surprised me there.

          Show
          sillyxone Huy Hoang added a comment - very funny, Dan! surprised me there.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Sep/13