Check out the LimeSurvey source code on GitHub!

Enforcing heterogenous responses

More
3 years 10 months ago #95093 by mikeg
Hi,

I'd like to use LimeSurvey as a part of a course peer assessment exercise. Basically, my students are working together in groups and part of their grade is determined by their peers' evaluation of their contribution. This part of a Team Based Learning teaching approach (e.g. see Michaelsen, Knight, and Fink's Team Based Learning (2004)).

The idea is that students will have Y other team members and have Y x 10 points to allocate in four different categories (preparation, contribution, respect for others, and flexibility to others ideas and suggestions). Most of the times students sense of 'fairness' will cause them to give everyone 10 points, regardless of the variation in student contribution. As a result, I want to enforce some heterogeneity. That is, force the students to give at least one student <= 9 points and another student >=11 points.

I'm familiar with LimeSurvey, but have no idea how to implement such a protocol. Does anyone out there know?

Thanks for your help with this.

Mike

Please Log in to join the conversation.

More
3 years 10 months ago #95103 by tpartner
You may be able to do this with a "Question validation equation" but I would find it easier just to use a little JavaScript listener on the inputs.

Can you provide a small sample survey with that question?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 9 months ago #95194 by mikeg
Hi Tony,

I'm a very basic user so here's my very basic survey. A few notes, I tried using array numbers for the peerScores part but it gave me a drop down menu that only ranged from 1-10. I need 1-15 so I went with array texts question structure.
Attachments:

Please Log in to join the conversation.

More
3 years 9 months ago #95231 by tpartner
Okay, maybe a little more than "a little JavaScript listener" ;)

1) Set up your survey to use JavaScript .

2) Add the following script to the source of the array. This script:
- Automatically identifies the parent question
- Inserts a "Points available" row
- Only allows entries between 1 and 15
- Does not allow entries exceeding the category total (10 x # of peers))
- Validates each category (column) to ensure that all inputs have a value and there is at least one entry under 10 points and at least one entry over 10 points
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		// Identify the question
		var q1ID = '{QID}';
		var q1 = $('#question'+q1ID+'');
 
		// Some vars...
		var ptsAvailableText = 'Points available';
		var pointsError1 = "You don't have enough points to do that!";
		var pointsError2 = "Points awarded must be between 1 and 15!";
		var pointsError3 = "Points must be awarded in all categories for every peer. Within each category, you must give at least one student 9 or less points and another 11 or more points.";
		var catPtsAvailable = $('tr:[id^="javatbd"]', q1).length * 10;
 
		// Insert a "Points available" row
		var index2 = $('tr:[id^="javatbd"]', q1).length - 2
		var newRow = $('.subquestions-list tbody tr:eq('+index2+')', q1).clone();
		$('input, label', newRow).remove();
		$('.answer-item', newRow).removeClass('answer-item text-item').addClass('points-item').text(catPtsAvailable);
		$('th', newRow).text(ptsAvailableText);
		$('.subquestions-list tbody', q1).append(newRow);
		tallyPoints();
 
		// Listener on the inputs
		$('input[type="text"]', q1).change(function(){
			var colClass = $(this).closest('td').attr('class').split(' ')[0];
			tallyPoints();
			if(Number($('.points-item.'+colClass+'', q1).text()) < 0) {
				alert(pointsError1);
				$(this).val('');
				tallyPoints();
			}
			else if($(this).val() < 1 || $(this).val() > 15) {
				alert(pointsError2);
				$(this).val('');
				tallyPoints();
			}
		});
 
		// Interrupt the Next/Submit function and validate each column
		$('form#limesurvey').submit(function(){
 
			// Override the built-in "disable navigation buttons" feature
			$('#moveprevbtn, #movenextbtn, #movesubmitbtn').attr('disabled', '');
 
			$('td.points-item', q1).each(function(i){
				var colClass = $(this).attr('class').split(' ')[0];
				var colError1 = 0;
				var colError2 = 1;
				var colError3 = 1;
				var colError4 = 0;
				$('.'+colClass+' input[type="text"]', q1).each(function(i){
					if($(this).val() < 10) {
						colError2 = 0;
					}
					if($(this).val() > 10) {
						colError3 = 0;
					}
					if($(this).val() == '') {
						colError4 = 1;
					}
				});
				if(colError2 == 1 || colError3 == 1 || colError4 == 1) {
					$('.'+colClass+'', q1).addClass('inputError');
				}
				else {
					$('.'+colClass+'', q1).removeClass('inputError');
				}
			});
			if($('td.inputError', q1).length > 0) {
				alert(pointsError3);
				return false;
			}
		});
 
		// A function to tally the column points
		function tallyPoints() {
			// Loop through each column and reset the points available
			$('td.points-item', q1).each(function(i){
				var colClass = $(this).attr('class').split(' ')[0];
				var currentPoints = catPtsAvailable;
				$('.'+colClass+' input[type="text"]', q1).each(function(i){
					currentPoints = currentPoints - $(this).val();
				});
				$('.points-item.'+colClass+'', q1).text(currentPoints);
			});
		}
	});
</script>
3) Add something like this to the end of template.css:
td.inputError {
	background-color: #FFC0CB;
}

Here's a working sample survey:

File Attachment:

File Name: limesurvey...9292.lss
File Size:27 KB



Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: mikeg

Please Log in to join the conversation.

More
3 years 9 months ago #95235 by mikeg
Dear tpartner,

Thanks for your help with this. It's very close to exactly what I need.

Unfortunately, I'm not familiar enough with JavaScript and LimeSurvey to figure out how to make it exactly what I need. So if you are feeling charitable and want to modify the code so that the 'Points Available' is 10 x the number of first names entered, I would be be very grateful (i.e. make a donation to limesurvey!)

Nevertheless, thanks for your help with this!

Please Log in to join the conversation.

More
3 years 9 months ago #95238 by tpartner
But...the names question is mandatory so all 5 rows must be completed...

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 9 months ago #95239 by mikeg
My mistake. The number of peers varies between groups. There are actually between 5 and 8 peers.

Please Log in to join the conversation.

More
3 years 9 months ago #95245 by tpartner
This script will automatically detect the number of rows (peers) in whatever question you put it in. So, assuming the associated "Name" question is mandatory, it should work as-is in all groups.

If the "Name" question is not mandatory, we will need to detect the number of names entered, adjust the "points available" and possibly hide some rows in the rating question. That gets a little messy.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 9 months ago #95478 by mikeg
I agree. I've implemented the 'dumb' version for now. If you're interested in helping us with this for next time I teach, I would be grateful (but I am not expecting this). Otherwise, I'll look around to see if I can find someone at my institution who can help with this in the future.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form