Moodle

Choice not working in 1.9 when using Limits

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9
  • Fix Version/s: 1.9.1
  • Component/s: Choice
  • Labels:
    None
  • Environment:
    lighttpd, php-cgi (fastcgi), mysql (all debian)
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

The form displaying the choice options is not being shown anymore when creating a new choice activity. This is independend from the role. In HTML-Code the whole form exept for the submission button is missing. Code from 1.9beta4 runs fine.

Issue Links

Activity

Hide
Dan Marsden added a comment -

Hi There,

the choice changed quite a bit just before the 1.9 release - can you please make sure you have updated copies of all the files in the choice folder?

thanks!

Dan

Show
Dan Marsden added a comment - Hi There, the choice changed quite a bit just before the 1.9 release - can you please make sure you have updated copies of all the files in the choice folder? thanks! Dan
Hide
Jörg Knegten added a comment -

Hi Dan,

I can approve this, idependently from Maik.

It worked in 1.9 Beta 4 but no longer in 1.9 final.

I just downlaoded the 1.9 final files completely from cvs and replaced the whole choice module.

Result: no boxes to make your choice

I replaced the choice module with the files from 1.9 Beta 4 and the boxes did appear immediately.

Jörg

Show
Jörg Knegten added a comment - Hi Dan, I can approve this, idependently from Maik. It worked in 1.9 Beta 4 but no longer in 1.9 final. I just downlaoded the 1.9 final files completely from cvs and replaced the whole choice module. Result: no boxes to make your choice I replaced the choice module with the files from 1.9 Beta 4 and the boxes did appear immediately. Jörg
Hide
Maik Riecken added a comment -

Previous copy of moodle has been deleted before fresh install. There should be no artefacts of old files.

Maik

Show
Maik Riecken added a comment - Previous copy of moodle has been deleted before fresh install. There should be no artefacts of old files. Maik
Hide
Dan Marsden added a comment -

are you sure that your users have the role: "mod/choice:choose" set to allow?

thanks,

Dan

Show
Dan Marsden added a comment - are you sure that your users have the role: "mod/choice:choose" set to allow? thanks, Dan
Hide
Dan Marsden added a comment -

there were also a few changes made to the Get_users_by_capability function in lib - make sure your lib files are all up-to-date as well....

Show
Dan Marsden added a comment - there were also a few changes made to the Get_users_by_capability function in lib - make sure your lib files are all up-to-date as well....
Hide
Dan Marsden added a comment -

ok - I'm having trouble replicating this - screenshots please? - and also details about the settings you have made in your choice? groups? limits? etc etc?

thanks!

Dan

Show
Dan Marsden added a comment - ok - I'm having trouble replicating this - screenshots please? - and also details about the settings you have made in your choice? groups? limits? etc etc? thanks! Dan
Hide
Dan Marsden added a comment -

think I've found it - 1min to patch.

Show
Dan Marsden added a comment - think I've found it - 1min to patch.
Hide
Dan Marsden added a comment -

fix now in 1.9Stable and Head.

find this in mod\choice\lib.php in function choice_show_form()

  • if (isset($text) && isset($allresponses[$optionid])) { //make sure there are no dud entries in the db with blank text values.

replace with this:
+ if (isset($text)) { //make sure there are no dud entries in the db with blank text values.

Show
Dan Marsden added a comment - fix now in 1.9Stable and Head. find this in mod\choice\lib.php in function choice_show_form()
  • if (isset($text) && isset($allresponses[$optionid])) { //make sure there are no dud entries in the db with blank text values.
replace with this: + if (isset($text)) { //make sure there are no dud entries in the db with blank text values.
Hide
Dan Marsden added a comment -

flagging this as fixed - please let me know if is/ is not fixed in your environments, so we can close this. - Thanks for the report!

Dan

Show
Dan Marsden added a comment - flagging this as fixed - please let me know if is/ is not fixed in your environments, so we can close this. - Thanks for the report! Dan
Hide
Jörg Knegten added a comment -

Hello Dan,

I loaded the files from cvs quite now.

It seems you did it. It's workling like it should.

Hope so, Maik gets the similar results.

Thanks.
Jörg

Show
Jörg Knegten added a comment - Hello Dan, I loaded the files from cvs quite now. It seems you did it. It's workling like it should. Hope so, Maik gets the similar results. Thanks. Jörg
Hide
Maik Riecken added a comment - - edited

Fixed. Thanks a lot. In debug mode unknown objects warnings showing up (path shortened):

Notice: Undefined offset: 5 in /mod/choice/lib.php on line 147

Notice: Undefined offset: 6 in /mod/choice/lib.php on line 147

Notice: Undefined offset: 7 in /mod/choice/lib.php on line 147

Show
Maik Riecken added a comment - - edited Fixed. Thanks a lot. In debug mode unknown objects warnings showing up (path shortened): Notice: Undefined offset: 5 in /mod/choice/lib.php on line 147 Notice: Undefined offset: 6 in /mod/choice/lib.php on line 147 Notice: Undefined offset: 7 in /mod/choice/lib.php on line 147
Hide
Dan Marsden added a comment -

thanks,

replace that line with this:
if (isset($allresponses[$optionid])) { $cdisplay[$aid]->countanswers = count($allresponses[$optionid]); } else { $cdisplay[$aid]->countanswers = 0; }

and it should remove the error - (I'll commit it sometime tomorrow.)

Show
Dan Marsden added a comment - thanks, replace that line with this: if (isset($allresponses[$optionid])) { $cdisplay[$aid]->countanswers = count($allresponses[$optionid]); } else { $cdisplay[$aid]->countanswers = 0; } and it should remove the error - (I'll commit it sometime tomorrow.)
Hide
Dan Marsden added a comment -

hmmm - my guess is that Demo.moodle.org hasn't been updated since the patch went in - will need to wait for it to be updated with the latest code from 1.9stable.

thanks,

Dan

Show
Dan Marsden added a comment - hmmm - my guess is that Demo.moodle.org hasn't been updated since the patch went in - will need to wait for it to be updated with the latest code from 1.9stable. thanks, Dan
Hide
Helen Foster added a comment -

Tested with latest 1.9+.

Dan, thanks for fixing

Show
Helen Foster added a comment - Tested with latest 1.9+. Dan, thanks for fixing

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: