Moodle
  1. Moodle
  2. MDL-35358

Impossible to grade essays when Lesson is Available for group members only

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.2.7, 2.3.4
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide

      Please test this across all supported DBs.

      1. As admin, 'enablegroupmembersonly' setting (site admin > development > experimental > experimental setting)
      2. Create group within the course
      3. Create a Lesson and make it available for group members only and select one Grouping from the Grouping dropdown list.
      4. Include at least one Essay in that lesson.
      5. Students take the Lesson.
      6. Teacher clicks on the Grade essays tab.
      7. Repeat test with a non-group members lesson
      Show
      Please test this across all supported DBs. As admin, 'enablegroupmembersonly' setting (site admin > development > experimental > experimental setting) Create group within the course Create a Lesson and make it available for group members only and select one Grouping from the Grouping dropdown list. Include at least one Essay in that lesson. Students take the Lesson. Teacher clicks on the Grade essays tab. Repeat test with a non-group members lesson
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Replication steps:

      1. Set a Lesson to Available for group members only and select one Grouping from the Grouping dropdown list.
      2. Include at least one Essay in that lesson.
      3. Students take the Lesson.
      4. Teacher clicks on the Grade essays tab.

      Error message is thrown:

      -----------------------------------------------------------------------------------------------
      Notice: Undefined offset: 8 in moodle\mod\lesson\essay.php on line 330
       
      Notice: Undefined offset: 8 in moodle\mod\lesson\essay.php on line 375
      Coding error detected, it must be fixed by a programmer: PHP catchable fatal error
      More information about this error
      Debug info: Argument 1 passed to core_renderer::user_picture() must be an instance of stdClass, null given, called in moodle\mod\lesson\essay.php on line 375 and defined 
      Error code: codingerror
      Stack trace:
      line 397 of \lib\setuplib.php: coding_exception thrown
      line 1884 of \lib\outputrenderers.php: call to default_error_handler()
      line 375 of \mod\lesson\essay.php: call to core_renderer->user_picture()
      ------------------------------------------------------------------------

      and it's impossible to continue

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Michael de Raadt added a comment -

            There is a problem with the query to find grouping members.

            I suspect that sometimes it will return no results and sometimes it will return incorrect results (leading to your error).

            I will attach a patch.

            Show
            Michael de Raadt added a comment - There is a problem with the query to find grouping members. I suspect that sometimes it will return no results and sometimes it will return incorrect results (leading to your error). I will attach a patch.
            Hide
            Joseph Rézeau added a comment -

            Thanks, Michael,
            Today I cannot reproduce the bug I posted. Weird!

            Show
            Joseph Rézeau added a comment - Thanks, Michael, Today I cannot reproduce the bug I posted. Weird!
            Hide
            Michael de Raadt added a comment -

            I also found the same grouping error on the report page.

            It doesn't surprise me that the error would be intermittent. The wrong fields are being matched in the query so any changes to groups/groupings would change the result.

            Show
            Michael de Raadt added a comment - I also found the same grouping error on the report page. It doesn't surprise me that the error would be intermittent. The wrong fields are being matched in the query so any changes to groups/groupings would change the result.
            Hide
            Rossiani Wijaya added a comment -

            Thank Michael for the patch.

            I'm able to see the error only in master.

            However, I created patch for 2.2, 2.3 and master to fix the query.

            Sending for peer review.

            Show
            Rossiani Wijaya added a comment - Thank Michael for the patch. I'm able to see the error only in master. However, I created patch for 2.2, 2.3 and master to fix the query. Sending for peer review.
            Hide
            Ankit Agarwal added a comment - - edited

            Hi Rosie,
            This looks good. Thanks
            [y] Syntax
            [y] Output
            [y] Whitespace
            [y] Language
            [y] Databases [confirmed with Dan, join with multiple criteria is cross db]
            [y] Testing [Might be nice to test this cross db during testing]
            [y] Security
            [na] Documentation
            [y] Git
            [y] Sanity check

            Show
            Ankit Agarwal added a comment - - edited Hi Rosie, This looks good. Thanks [y] Syntax [y] Output [y] Whitespace [y] Language [y] Databases [confirmed with Dan, join with multiple criteria is cross db] [y] Testing [Might be nice to test this cross db during testing] [y] Security [na] Documentation [y] Git [y] Sanity check
            Hide
            Rossiani Wijaya added a comment -

            Thanks for the review.

            Submitting for integration review.

            Show
            Rossiani Wijaya added a comment - Thanks for the review. Submitting for integration review.
            Hide
            Dan Poltawski added a comment -

            The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

            TIA and ciao

            Show
            Dan Poltawski added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
            Hide
            Dan Poltawski added a comment -

            Thanks Rosie & Michael, i've integrated this now (master, 22, 23)

            Show
            Dan Poltawski added a comment - Thanks Rosie & Michael, i've integrated this now (master, 22, 23)
            Hide
            Mark Nelson added a comment -

            Unfortunately I can not get my virtual box to boot up Windows without it crashing. Matt has said this will take some time to investigate/fix. In the meantime I can only test on MySQL and Postgres.

            Show
            Mark Nelson added a comment - Unfortunately I can not get my virtual box to boot up Windows without it crashing. Matt has said this will take some time to investigate/fix. In the meantime I can only test on MySQL and Postgres.
            Hide
            Mark Nelson added a comment -

            I have simplified this test by attaching a backup of a course with all the requirements for this test. Simply restore this course, log in as an administrator and click on both lessons and ensure you can click on the 'Grade Essays' tab.

            Show
            Mark Nelson added a comment - I have simplified this test by attaching a backup of a course with all the requirements for this test. Simply restore this course, log in as an administrator and click on both lessons and ensure you can click on the 'Grade Essays' tab.
            Hide
            Mark Nelson added a comment -

            This works in MySQL and Postgres.

            Show
            Mark Nelson added a comment - This works in MySQL and Postgres.
            Hide
            Michael de Raadt added a comment -

            I tested this in MSSQL and Oracle.

            In MSSQL, there was no error, but it didn't recognise there were essay questions in a lesson that had them.

            The message reported was...

            No essay questions found in this lesson.

            Show
            Michael de Raadt added a comment - I tested this in MSSQL and Oracle. In MSSQL, there was no error, but it didn't recognise there were essay questions in a lesson that had them. The message reported was... No essay questions found in this lesson.
            Hide
            Mark Nelson added a comment -

            As Michael noted the SQL query is returning no results for MSSQL under the same conditions.

            Show
            Mark Nelson added a comment - As Michael noted the SQL query is returning no results for MSSQL under the same conditions.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Hi guys, I think Rossie's patch has nothing to do with MSSQL (and/or Oracle) returning "no essay questions found in this lesson". I'm going to investigate a bit deeper and, surely, will end creating a new issue for that problem, making this to pass.

            Show
            Eloy Lafuente (stronk7) added a comment - Hi guys, I think Rossie's patch has nothing to do with MSSQL (and/or Oracle) returning "no essay questions found in this lesson". I'm going to investigate a bit deeper and, surely, will end creating a new issue for that problem, making this to pass.
            Hide
            Joseph Rézeau added a comment -

            Hi Eloy,
            We have had quite a few complaints on the Lesson forum from users who said they had the "no essay questions found in this lesson" error message on lessons where they were sure students had filled in the essays.
            I have never been able to replicate this problem, but it must exist.

            Show
            Joseph Rézeau added a comment - Hi Eloy, We have had quite a few complaints on the Lesson forum from users who said they had the "no essay questions found in this lesson" error message on lessons where they were sure students had filled in the essays. I have never been able to replicate this problem, but it must exist.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            I think we can consider this passed and about the "no essay questions found in this lesson" under MSSQL, continue working @ MDL-29873, that seems to describe the problem pretty well.

            Show
            Eloy Lafuente (stronk7) added a comment - I think we can consider this passed and about the "no essay questions found in this lesson" under MSSQL, continue working @ MDL-29873 , that seems to describe the problem pretty well.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Passing in behalf of Mark.

            Show
            Eloy Lafuente (stronk7) added a comment - Passing in behalf of Mark.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Many, many thanks for your effort!

            Millions of people will enjoy the results of your work, yay!

            Closing as fixed. Ciao

            Show
            Eloy Lafuente (stronk7) added a comment - Many, many thanks for your effort! Millions of people will enjoy the results of your work, yay! Closing as fixed. Ciao

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: