Limiting the number of answers in seprarate groups mode

Limiting the number of answers in seprarate groups mode

by Jacek Kosinski -
Number of replies: 19
Hi, the number of answers should be counted per group or for all students in separate groups mode? I need to use choice for assigning students to projects. In each group only one student can choose the given project. Two students can choose the same project if these students belong to different groups. Is this possible in the current moodle version?
Average of ratings: -
In reply to Jacek Kosinski

Re: Limiting the number of answers in seprarate groups mode

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 Jacek,

this line in mod\choice\view.php gets the number of answers for a choice to calculate how many people have selected a particular choice:

$countanswers = (get_records("choice_answers", "optionid",
$optionid));

- this doesn't take any notice of what group the user is in.

you could set up seperate Choice's for each group, but

also goto http://moodle.org/bugs and log a feature request for this, I might get to adding the feature sometime!

smile

Dan
In reply to Dan Marsden

Re: Re: Limiting the number of answers in seprarate groups mode

by Jacek Kosinski -
Hi Dan

thank you for your quick answer. Creating so many choice would not solve the problem, because eg. one student could vote in every choice. Smutek

Actually the time to create so many choices would be longer than writing the patch to view.php. Szeroki uśmiech

I attach the new fixed  version of view.php without  this issue. It's tested and works properly. Perhaps worth putting it into CVS.

Jacek
In reply to Jacek Kosinski

Re: Re: Limiting the number of answers in seprarate groups mode

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 Jacek,

nice work! - there's a slightly newer version of View.php that allows the admin to be shown in the listing. I've modified your view.php - try the attached file. - I notice you've also killed some ugly "stupid" JS with some better code! (I haven't tested the page yet!)

- can you also make your modifications to report.php? - I'll upload them to CVS after testing on this end!

smile

Dan
In reply to Dan Marsden

Re: Re: Limiting the number of answers in seprarate groups mode

by Erik Ringmar -

Hi guys,

This is great, and just what I need for a course I'm running.  However, I don't know what to do with the view.php file.  I'm new to moodle and not much of a programmer.  Any help would be much appreciated.

cheers,

Erik

In reply to Erik Ringmar

Re: Re: Limiting the number of answers in seprarate groups mode

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
the file is for a 1.5.3 moodle install - replace the file in your moodle install called \mod\choice\view.php with the above attached file. - I've been pretty busy the past few months, I'll try to search through my e-mails to see if jacek actually tested the file I posted. - be careful running this in production though - I can't rememeber the status of it!

thanks,

smile

Dan
In reply to Dan Marsden

Re: Re: Limiting the number of answers in seprarate groups mode

by Peter Rennspies -

This is exactly what I was looking for. Thanks!

Will it work with 1.5.2 as well? Can you tell if it will be incorporated in version 1.6?

In reply to Peter Rennspies

Re: Re: Limiting the number of answers in seprarate groups mode

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
It never got tested properly - I'll have a look at creating a new patched file for people to test in the next couple of days.

thanks,

Dan
In reply to Peter Rennspies

Limiting the number of answers in seprarate groups mode 1.6 Patch

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
Here's a patch for 1.6 which should do this. - I don't think it will make it into 1.6 for release unless it gets a bit of testing by the community. - it might end up in 1.6+ later on. - let me know how it goes.

replace the files in your mod\choice directory with the files in the attached zip file.

thanks,

smile

Dan
In reply to Dan Marsden

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Any progress on getting this in to CVS? I was hoping that it would be added. I have a teacher that is wanting to do this. I downloaded the patch but I am working to differentiate the changes in the patch to the changes in CVS (1.35 vs. 1.37.2.2 for lib.php). By chance do you have a patched version for 1.6.3+?
In reply to Dan Marsden

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

by Jacek Kosinski -
Hello Dan,

I have checked your modification for moodle-16. But in my opinion it will not work, since moodle-16 allows a single user to participate in more than one group. To make this work we need to record group number in a table choice_answers, and in view.php allow a student to select for which group the choice is made.

There is a similar problem with teachers, a teacher can belong to many groups or not belong to any. What you think about this large modifications and stable state of choice module in 1.6 branch?

Jacek
In reply to Jacek Kosinski

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
I checked out the 1.6 patch for limiting the number of answers in separate groups mode and did not feel that it did what I was hoping. First, I patched the patch to update it with the various corrections that have been made in CVS for the lib.php and view.php files. It is possible that I may have messed something up but I don't think so. I've attached a zip file containing my patches which you can check/use as you wish.

I was hoping that if I had separate groups, then it would use the limit number as the limit per group. I use metacourses for teachers who teach various sections of the same course (for example, Algebra 1-Section 01, Algebra 1-Section 2). I create a metacourse called Algebra 1-TeacherName with the section courses as children. Then I create a group for each child course and put in the group the participants that correspond to each section. I would like to be able to use a choice with separate groups to allow one student from each section to sign up for a topic. The patch did not seem to allow that behavior and I did not like that it seemed to log out the user if someone else had already picked an option.

Currently, I have instructed teachers to create a single choice for each section but this is not ideal. If a feature request does not exist, I would be happy to create one if there is interest in further developing the use of groups with the choice activity. With improvements with groups in 1.8 and 1.9 it seems like an opportune time to make such a request. Peace.
In reply to Anthony Borrow

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

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 Anthony,

I've never really been happy with the way the Choice works with groups - I just haven't had the chance to sit down and figure out how it "should" work!  - Would love for you or anyone else to work out how you feel it should work and put it in as an improvement in the Tracker. - I'm not sure when I will get a chance to implement what is being asked for, but if the tracker item is well written and thought out, I might just manage it before 1.8 release! - (I have got a few other things I'm hoping to have ready for then anyway!)

Thanks!

smile

Dan

In reply to Dan Marsden

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Dan - I have added the following comment on MDL-7429 to rework how groups are handled in a choice and figured I would throw my ideas out here on the forum to see if what I am thinking makes sense and if others agree with that thinking. Peace - Anthony

-- from MDL-7429:
I have given some thought to how to handle groups or at least how I would like to see them implemented/revised to work in choice activities. The behavior would remain the same for no groups - any member of the course can select an item with the limit being enforced for that one choice.

For visible groups, I would like one choice created for each group (similar to wikis, forums, etc.). I believe that this consistency is important. Within the choice for that group the limits are enforced. Hence, one student per group being able to sign up for a given topic. Some code may need to be re-worked to view the results of other groups. If the results of the choice are published (i.e. visible to students), then the members of other groups should be able to see the those results.

For separate groups, I would like one choice created for each group. Within the choice for that group the limits are enforced. A student who is not in the group would not be able to view the results of other groups.
--


In reply to Anthony Borrow

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

by Jacek Kosinski -
Hello Anthony,

yours comments on MDL-7429 are pretty clear for me (my original patch for moodle 1.5 works like this), but as I wrote in my previews post in current moodle versions student (and teacher) can belong to more than a single group. These students should have a possibility to select for which group they made a choice. Without this support the new implementation of limiting the number of answers in choice module will be incomplete.
In reply to Jacek Kosinski

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
As I envision dealing with groups in choice, a student who is a member of more than one group would be able to respond once in each group that he belongs to. However, I could see adding some code to check and see if the student had submitted a choice in another group. Similar to how the teacher gets a drowdown box for groups, a similar type interface could be added so that the student could choose for which group he was responding. I think these are good suggestions for looking at how to better implement groups with a choice activity. Peace.
In reply to Anthony Borrow

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

by David Brighton -
I have just discovered this inconsistency, we are using 1.7.1. It would be great if it could be fixed as it limits what can be done in courses where we split the cohorts into groups. Doesn't seem to have appeared on any of the developers radars yet, I have added a vote for it.
In reply to Jacek Kosinski

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

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 Jacek,

This would not make it into 1.6(except as a custom patch) - it could possibly end up in 1.8 or later however.

Thanks,

smile

Dan

In reply to Dan Marsden

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

by Joan Codina Filba -
Dan,
Any patch for 1.8.3+?
if instead of putting the zip of the files I would prefer to have a patch (a diff) that allows to apply the changes to the current version.... the I could do it myself...

Joan



In reply to Joan Codina Filba

Re: Limiting the number of answers in seprarate groups mode 1.6 Patch

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 Joan,

Have a quick look at David Murdak's patch in MDL-11850 - I plan on reviewing it properly this week or next - it might solve your problem!

Note. - the patch will likely not work correctly in Moodle 1.9 - the choice lib is changing a bit in those areas.

Thanks,

smile

Dan