Moodle
  1. Moodle
  2. MDL-5262

PHP notice when sorting on R% coloumn in the Item analysis report

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.6.6, 1.7.4, 1.8.4, 1.9, 2.0
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      All
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      28201

      Description

      On report.php analysis page, if I click on many of the column headers to sort by them, I get the following messages. It only happens with some columns.:

      Notice: Undefined index: answers in /home/moodtest/public_html/mod/quiz/report/analysis/report.php on line 293

      Notice: Undefined index: answers in /home/moodtest/public_html/mod/quiz/report/analysis/report.php on line 293

      Notice: Undefined index: answers in /home/moodtest/public_html/mod/quiz/report/analysis/report.php on line 293

      Notice: Undefined index: answers in /home/moodtest/public_html/mod/quiz/report/analysis/report.php on line 293

      I am looking specifically at this page, for example:

      http://test.moodle.com/mod/quiz/report.php?q=4&mode=analysis&tsort=rpercent

        Activity

        Hide
        Martin Dougiamas added a comment -

        From Gustav Delius (gwd2 at york.ac.uk) Friday, 21 April 2006, 04:22 AM:

        Nicole, php notices are not really a problem, they are just an aid to developers alerting them to parts of the code that could do with some cleanup. I have therefore reduced the priority of this. Nevertheless please continue to report notices that you find.

        From Martin Dougiamas (martin at moodle.com) Friday, 21 April 2006, 09:46 AM:

        Will you fix it, Delius?

        From Martin Dougiamas (martin at moodle.com) Friday, 21 April 2006, 09:47 AM:

        Sorry if that sounded rude, I'm in assign a hundred bugs mode

        From Gustav Delius (gwd2 at york.ac.uk) Friday, 21 April 2006, 03:10 PM:

        Martin, I don't mind short bug tracker entries, but I wish the bugtracker would use real names. I prefer to be called Gustav rather than Delius. Maybe the Google summer of code will finally give us a decent bugtracker.

        I don't know if I will get around to fixing this before handing the quiz module over to the OU. There are higher priority bugs around.

        From Jean_Michel Vedrine (jean-michel.vedrine at wanadoo.fr) Monday, 1 May 2006, 04:56 PM:

        This is because some columns have wrong names. To correct most of the problems do the following search/replace (NOTE: all single quotes MUST be included in both search and replace strings, for instance if you try to replace all sd with qsd without the quotes, you will break the file !!)

        change all occurences of 'discrimination_coeff' to 'disc_coeff' (3 occurences)

        change all occurences of 'discrimination_index' to 'disc_index' (3 occurences)

        change all occurences of 'sd' to 'qsd' (3 occurences)

        change all occurences of 'answers' to 'responses' (1 occurence only)

        This will correct all problems except the R% one, because I was unable to find the matching name for the rpercent column in $row.

        I will study the problem.

        As Gustav said, it's only a notice so not harmfull, and my corrections allow sorting to work on most columns wich is already a progress !

        From Gustav Delius (gwd2 at york.ac.uk) Tuesday, 2 May 2006, 04:38 PM:

        Thanks Jean-Michel. I have committed those changes. I have made you the owner of this bug.

        From Jean_Michel Vedrine (jean-michel.vedrine at wanadoo.fr) Tuesday, 2 May 2006, 05:59 PM:

        Wonderfull ! I am owning more and more bugs, maybe the begining of a braider career !

        Show
        Martin Dougiamas added a comment - From Gustav Delius (gwd2 at york.ac.uk) Friday, 21 April 2006, 04:22 AM: Nicole, php notices are not really a problem, they are just an aid to developers alerting them to parts of the code that could do with some cleanup. I have therefore reduced the priority of this. Nevertheless please continue to report notices that you find. From Martin Dougiamas (martin at moodle.com) Friday, 21 April 2006, 09:46 AM: Will you fix it, Delius? From Martin Dougiamas (martin at moodle.com) Friday, 21 April 2006, 09:47 AM: Sorry if that sounded rude, I'm in assign a hundred bugs mode From Gustav Delius (gwd2 at york.ac.uk) Friday, 21 April 2006, 03:10 PM: Martin, I don't mind short bug tracker entries, but I wish the bugtracker would use real names. I prefer to be called Gustav rather than Delius. Maybe the Google summer of code will finally give us a decent bugtracker. I don't know if I will get around to fixing this before handing the quiz module over to the OU. There are higher priority bugs around. From Jean_Michel Vedrine (jean-michel.vedrine at wanadoo.fr) Monday, 1 May 2006, 04:56 PM: This is because some columns have wrong names. To correct most of the problems do the following search/replace (NOTE: all single quotes MUST be included in both search and replace strings, for instance if you try to replace all sd with qsd without the quotes, you will break the file !!) change all occurences of 'discrimination_coeff' to 'disc_coeff' (3 occurences) change all occurences of 'discrimination_index' to 'disc_index' (3 occurences) change all occurences of 'sd' to 'qsd' (3 occurences) change all occurences of 'answers' to 'responses' (1 occurence only) This will correct all problems except the R% one, because I was unable to find the matching name for the rpercent column in $row. I will study the problem. As Gustav said, it's only a notice so not harmfull, and my corrections allow sorting to work on most columns wich is already a progress ! From Gustav Delius (gwd2 at york.ac.uk) Tuesday, 2 May 2006, 04:38 PM: Thanks Jean-Michel. I have committed those changes. I have made you the owner of this bug. From Jean_Michel Vedrine (jean-michel.vedrine at wanadoo.fr) Tuesday, 2 May 2006, 05:59 PM: Wonderfull ! I am owning more and more bugs, maybe the begining of a braider career !
        Hide
        Stephen Bourget added a comment -

        Under Moodle 1.6.2+ and Moodle 1.7Dev the only column that generates any notices is: R%

        It shows the following 2 notices:

        Notice: Undefined index: rpercent in C:\WebSites\MoodleStable\mod\quiz\report\analysis\report.php on line 292

        Notice: Undefined index: rpercent in C:\WebSites\MoodleStable\mod\quiz\report\analysis\report.php on line 292

        -Steve

        Show
        Stephen Bourget added a comment - Under Moodle 1.6.2+ and Moodle 1.7Dev the only column that generates any notices is: R% It shows the following 2 notices: Notice: Undefined index: rpercent in C:\WebSites\MoodleStable\mod\quiz\report\analysis\report.php on line 292 Notice: Undefined index: rpercent in C:\WebSites\MoodleStable\mod\quiz\report\analysis\report.php on line 292 -Steve
        Hide
        Jean-Michel Vedrine added a comment -

        Yes as I explained the rpercent data isn't in the $row variable. To fix this problem we need to somewhat change the way (and place) where rpercent is calculated.

        Show
        Jean-Michel Vedrine added a comment - Yes as I explained the rpercent data isn't in the $row variable. To fix this problem we need to somewhat change the way (and place) where rpercent is calculated.
        Hide
        Tim Hunt added a comment -

        Taking this bug, Hopefully I will get time to fix it soon.

        Show
        Tim Hunt added a comment - Taking this bug, Hopefully I will get time to fix it soon.
        Hide
        Tim Hunt added a comment -

        I took the simple option of making that column not sortable, since it would be hard to restructure the calculation.

        Show
        Tim Hunt added a comment - I took the simple option of making that column not sortable, since it would be hard to restructure the calculation.
        Hide
        Nicolas added a comment -

        I found that this small change in 'analysis/report.php' introduces a problem in my 1.8.3+ install (upgrade from 1.8.2) : the analysis table doesn't display anymore (display stops with the separated group menu, then nothing). When I comment the only line 249 in analysis/report.php ( $table->no_sorting('rpercent'); ) all is going well.

        Show
        Nicolas added a comment - I found that this small change in 'analysis/report.php' introduces a problem in my 1.8.3+ install (upgrade from 1.8.2) : the analysis table doesn't display anymore (display stops with the separated group menu, then nothing). When I comment the only line 249 in analysis/report.php ( $table->no_sorting('rpercent'); ) all is going well.
        Hide
        Tim Hunt added a comment -

        Drat! I did not notice that the no_sorting method did not exist before Moodle 1.9. I'll fix this tomorrow, I hope.

        Show
        Tim Hunt added a comment - Drat! I did not notice that the no_sorting method did not exist before Moodle 1.9. I'll fix this tomorrow, I hope.
        Hide
        Tim Hunt added a comment -

        MDL-11416 has the code to implement no_sorting. I think I will probably back-port this to the earlier branches.

        Show
        Tim Hunt added a comment - MDL-11416 has the code to implement no_sorting. I think I will probably back-port this to the earlier branches.
        Hide
        Tim Hunt added a comment -

        OK, I have now back-ported the patch from MDL-11416, so this should now be working.

        Show
        Tim Hunt added a comment - OK, I have now back-ported the patch from MDL-11416 , so this should now be working.
        Hide
        Pierre Pichet added a comment -

        Reworking the report.php, I have found that the solution is to create the questions['rpercent'] array, for example

        foreach ($questions as $qid=>$q) {
        $questions[$qid] = $this->report_question_stats($q, $attemptscores, $statstable, $top, $bottom);
        // calculate rpercent
        foreach($q['responses']as $aid => $resp)

        { $rpercent = '('.format_float($q['rcounts'][$aid]/$q['count']*100,0).'%)'; $questions[$qid]['rpercent'][$aid] = $rpercent ; }

        }
        and reactivating the rpcent column.
        I will use a similar code in the new version or report.php.
        I just report here as a to-do item...

        Show
        Pierre Pichet added a comment - Reworking the report.php, I have found that the solution is to create the questions ['rpercent'] array, for example foreach ($questions as $qid=>$q) { $questions [$qid] = $this->report_question_stats($q, $attemptscores, $statstable, $top, $bottom); // calculate rpercent foreach($q ['responses'] as $aid => $resp) { $rpercent = '('.format_float($q['rcounts'][$aid]/$q['count']*100,0).'%)'; $questions[$qid]['rpercent'][$aid] = $rpercent ; } } and reactivating the rpcent column. I will use a similar code in the new version or report.php. I just report here as a to-do item...

          People

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

            Dates

            • Created:
              Updated:
              Resolved: