Moodle
  1. Moodle
  2. MDL-23867

Choice displays notices when it is set to always display results but there none.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Choice
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      27159

      Description

      I've just created a choice, I've set it up so that everyone can view the choice results, it's not anonymous, and results are shown all the time.
      When I go to view the assignment I get several notices:

      • Notice: Trying to get property of non-object in /var/www/moodle/m20_dev1/moodle/mod/choice/renderer.php on line 99
      • Notice: Trying to get property of non-object in /var/www/moodle/m20_dev1/moodle/mod/choice/renderer.php on line 102
      • Warning: ksort() expects parameter 1 to be array, null given in /var/www/moodle/m20_dev1/moodle/mod/choice/renderer.php on line 333
      • Warning: Invalid argument supplied for foreach() in /var/www/moodle/m20_dev1/moodle/mod/choice/renderer.php on line 336

      I imagine these would all be resolved by handling the no results situation.

      Assigning to the current author of the display code

        Activity

        Hide
        Sam Hemelryk added a comment -

        Ahh let me add to that, it is only when there are no enrolled users!

        Show
        Sam Hemelryk added a comment - Ahh let me add to that, it is only when there are no enrolled users!
        Hide
        Rossiani Wijaya added a comment -

        Thanks Sam for reporting.

        I've fixed the error and commit the changes. Please take a look.

        Rosie

        Show
        Rossiani Wijaya added a comment - Thanks Sam for reporting. I've fixed the error and commit the changes. Please take a look. Rosie
        Hide
        Dan Marsden added a comment -

        Hi Rosie,

        that commit seems to add some extra whitespace to the ends of various lines - can you please fix those up?

        for example end of this line in view.php:
        get_login_url(), new moodle_url('/course/view.php', array('id'=>$course->id)));

        and extra spaces in the line after:
        $renderer = $PAGE->get_renderer('mod_choice');

        then a few in lib.php as well.

        thanks!

        Show
        Dan Marsden added a comment - Hi Rosie, that commit seems to add some extra whitespace to the ends of various lines - can you please fix those up? for example end of this line in view.php: get_login_url(), new moodle_url('/course/view.php', array('id'=>$course->id))); and extra spaces in the line after: $renderer = $PAGE->get_renderer('mod_choice'); then a few in lib.php as well. thanks!
        Hide
        Rossiani Wijaya added a comment -

        Thanks Dan for reporting.

        The file has been fixed and re-committed.

        Show
        Rossiani Wijaya added a comment - Thanks Dan for reporting. The file has been fixed and re-committed.
        Hide
        Dan Marsden added a comment -

        thanks Rosie!

        Show
        Dan Marsden added a comment - thanks Rosie!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: