choice not showing any options 1.5.3

choice not showing any options 1.5.3

by Mikko Toivola -
Number of replies: 9
forgive me if this issue has already been covered, but since I couldn't find info on how to fix it, I'm posting this here.

For some reason in the latest cvs version of moodle (1.5.3 at 24th January 2006) choice module was not showin options for any choice made before or after previous update. Nor was there any error message. I had to change line 137 of the view.php file in the following way to get it to work for me.

original line:
switch ($choice->display)

altered (working)line:
switch ($choice->format)

Average of ratings: -
In reply to Mikko Toivola

Re: choice not showing any options 1.5.3

by Graham Stone -
Picture of Testers
Hi,

I'm also having the same problem, i'm on version 1.5.3+ and when I add a new choice to a course it is not displaying any options.  I've tried this on a couple of different VLEs (all same version) and it still dosn't work.  Any choices I had on before the upgrade work fine.


Can anybody help?

Thanks,
In reply to Graham Stone

Re: choice not showing any options 1.5.3

by Mikko Toivola -
As I said in the previous post, my workaround was to modify the %moodledir%/mod/choice/view.php file. Edit the file and search for the line:
switch ($choice->display)

once found, change the word display to format like so:
switch ($choice->format)

the switch is about display formatting issue, whether to present the choices side by side or below the previous choice eg vertically or horizontally.

I think it is a bug, that gets fixed in later versions.

however, attaching my /mod/choice/view.php for convenience
In reply to Mikko Toivola

Re: choice not showing any options 1.5.3

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Just to clarify things a bit here - let me get this right....

before upgrade choices show fine,

after upgrade choices don't show...

the fix isn't to alter the code, you will need to "update the choice" and hit save - hopefully this will clear the issue. -

my guess is that when the upgrade happened, the default value for display mode wasn't set - display mode allows different ways of displaying the choice options. - (horizontally or vertically) - I'll try to investigate further why a default value wasn't used during the upgrade. - what db and db versions are you using?

thanks,

Dan
In reply to Dan Marsden

Re: choice not showing any options 1.5.3

by Mikko Toivola -
I was not able to confirm, that choice had worked between upgrades from 1.1.1 to 1.5 and to 1.5.3. At least it was working in version 1.1.1 in May last year.

dbengine is mysql 5.0.6-beta

Mikko
In reply to Mikko Toivola

Re: choice not showing any options 1.5.3

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Hi Mikko,

are you able to check the database and see if the default value is set for the display column? - also check the data - make sure all the rows in the choice table have a value that is not null in the field (0 is ok, NULL is not.) if you spot any that are NULL, set them to 0

let me know how you go!

smile

Dan
In reply to Dan Marsden

Re: choice not showing any options 1.5.3

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
oops - just read your post completely..... there are a couple of other issues with Choice's when using MySql 5 - there is a new reserved word.

the fix is in the HEAD branch of moodle, and will be released with 1.6, - (I just modified it further this morning, so it won't be available via public cvs for a few more hours.)
- If you need a patch for 1.5.3 before 1.6 is relased, flick me an e-mail, and I will forward on the code we are running in our 1.5 install.

smile

Dan
In reply to Dan Marsden

Re: choice not showing any options 1.5.3

by David Brighton -
Hi Dan

I am running on a versin 5 database and running into problems as well. Is it worth posting the fix here? Mine seems to work OK and then errors at the confirm stage with "Could not add a new instance of choice"

Regards

David