Moodle
  1. Moodle
  2. MDL-29018

Lesson detailed statistics not displayed for whole class

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.4, 2.1.1, 2.2
    • Fix Version/s: 2.0.5, 2.1.2
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide

      login as teacher/admin
      #create lesson with question

      login as student
      #attempt the lesson

      #login as teacher/admin

      1. select the lesson
      2. select "report"
      3. select "Detailed statistics"

      make sure it displays the class statistics.

      note: if there's no attempt on the lesson, the page will display 'No attempts have been made on this lesson.' message.

      Show
      login as teacher/admin #create lesson with question login as student #attempt the lesson #login as teacher/admin select the lesson select "report" select "Detailed statistics" make sure it displays the class statistics. note: if there's no attempt on the lesson, the page will display 'No attempts have been made on this lesson.' message.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      18560

      Description

      Lesson detailed statistics not displayed for whole class.
      See this discussion: http://moodle.org/mod/forum/discuss.php?d=183600

      1.- Suggested fix (for moodle 2.0 and 2.1)
      in mod/lesson/report.php, line 563
      change

      if (!empty($page->answerdata) && isset($page->answerdata->response)) {
      

      to:

      if (!empty($page->answerdata) && (empty($userid) || (!empty($userid) && isset($page->answerdata->response)))) {
      

      2.- Plus: when student did not answer a question, in the Detailed (individual) statistics it would be nicer to display "Did not answer this question." rather than "0".
      in mod/lesson/report.php, line 577 change

      $table->data[] = array(0, " ");
      

      to:

      $table->data[] = array(get_string('didnotanswerquestion', 'lesson'), " ");
      

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting that and providing a solution.

          Show
          Michael de Raadt added a comment - Thanks for reporting that and providing a solution.
          Hide
          Rossiani Wijaya added a comment -

          Hi Joseph,

          Thanks for providing the patch.

          I simplified the logic for the page answer data and response to:
          line 563:

          if (!empty($page->answerdata)) {
          

          Then do the following to the answer data response (line 572):

          if (isset($page->answerdata->response) && $page->answerdata->response != NULL) {
          
          Show
          Rossiani Wijaya added a comment - Hi Joseph, Thanks for providing the patch. I simplified the logic for the page answer data and response to: line 563: if (!empty($page->answerdata)) { Then do the following to the answer data response (line 572): if (isset($page->answerdata->response) && $page->answerdata->response != NULL) {
          Hide
          Rajesh Taneja added a comment -

          Thanks for fixing this Rossie
          Just one thing:
          You probably want to remove redundant check

          mod/lesson/report.php - line 572
          if (isset($page->answerdata->response) && $page->answerdata->response != NULL) {
          

          isset determines if a variable is set and is not NULL, so checking it again is redundant

          Show
          Rajesh Taneja added a comment - Thanks for fixing this Rossie Just one thing: You probably want to remove redundant check mod/lesson/report.php - line 572 if (isset($page->answerdata->response) && $page->answerdata->response != NULL) { isset determines if a variable is set and is not NULL, so checking it again is redundant
          Hide
          Rossiani Wijaya added a comment -

          updating patch and change the check for response to !empty.

          Show
          Rossiani Wijaya added a comment - updating patch and change the check for response to !empty.
          Hide
          Rossiani Wijaya added a comment -

          Thanks for reviewing Raj.

          Submitting for integration.

          Show
          Rossiani Wijaya added a comment - Thanks for reviewing Raj. Submitting for integration.
          Hide
          Sam Hemelryk added a comment -

          Hi Rosie,

          Sending this back around this week as there is a bug with the patch.
          It should not be using empty() as the user may have provided a valid response of 0 (considered empty).

          On another note while testing this I found that it is impossible to create a short answer question with an answer (either correct or otherwise) of 0.
          Likely the same sort of issue popping up again. I'll create a new bug for this issue now.

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - Hi Rosie, Sending this back around this week as there is a bug with the patch. It should not be using empty() as the user may have provided a valid response of 0 (considered empty). On another note while testing this I found that it is impossible to create a short answer question with an answer (either correct or otherwise) of 0. Likely the same sort of issue popping up again. I'll create a new bug for this issue now. Cheers Sam
          Hide
          Sam Hemelryk added a comment -

          Linking to MDL-29230 to fix the 0 answer bug I spotted.

          Show
          Sam Hemelryk added a comment - Linking to MDL-29230 to fix the 0 answer bug I spotted.
          Hide
          Rossiani Wijaya added a comment -

          Hi Sam,

          I updated the patch by removing the empty() check for response. As Raj mentioned above that isset() is also checking for NULL value, it is not necessary to add != null check.

          Re-submitting for integration.

          Show
          Rossiani Wijaya added a comment - Hi Sam, I updated the patch by removing the empty() check for response. As Raj mentioned above that isset() is also checking for NULL value, it is not necessary to add != null check. Re-submitting for integration.
          Hide
          Sam Hemelryk added a comment -

          Thanks for fixing that up Rosie, this has been integrated now

          Show
          Sam Hemelryk added a comment - Thanks for fixing that up Rosie, this has been integrated now
          Hide
          Ankit Agarwal added a comment -

          test passed
          Thanks

          Show
          Ankit Agarwal added a comment - test passed Thanks
          Hide
          Eloy Lafuente (stronk7) added a comment -

          git & cvs repositories updated with your gorgeous code. Many thanks!

          Closing and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - git & cvs repositories updated with your gorgeous code. Many thanks! Closing and ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: