Change Question type 1..N to Question type 0..N

Change Question type 1..N to Question type 0..N

дэргэд José Ángel Polo -
Хариу нийтлэлийн тоо: 17

Is there any way that the scale on the type of question 1 to N, is changed by 0 to N?

Best Regards.

Үнэлгээний дундаж: -
José Ángel Polo-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг
Hi José,
I suppose you are talking about the Rate question type. If you want something to be rated from 0 to 4, instead of 1 to 5, for example, in the the Possible answers field, just type:
1=0
2=1
3=2
4=3
5=4
See attached screenshot.
Joseph
Хавсралт image00.jpg
Joseph Rézeau-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд José Ángel Polo -

Hi Joseph.

What I need is change like that:

Change 0 to N

Thanks in advance. 

José Ángel Polo-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг
Possible answers:
1. Existe correspondencia entre objetivos y contenidos de la ccion formativa
2. La documentacion y materiales ... son comprensibles y adecuados.
3. Los medios y soportes digitales son adecuados.
1=0
2=1
3=2
4=3
5=4
6=5
7=6
8=7
9=8
10=9

Хавсралт image00.jpg
Joseph Rézeau-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд José Ángel Polo -

I have the same problem as in the survey module.
The scale moves from 1 to 11 instead of 0 to 10.
In the survey module to download this occurred in xls or ods format results (See Fig 2 and Fig 3); in this module is moved after answering questionnaire as shown in the image below (see Fig 1).
Can you help me? Thank you very much.

Fig 1 - Questionnaire Module

Idem problem as Survey Module

Fig 2 Survey Module

Idem problem as Survey Module

Fig 3 Survey Module

Idem problem as Survey Module

José Ángel Polo-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг
OK, I understand the problem now. I'm afraid there is no satisfactory solution. But, in the example you provide, are you absolutely sure you need a 0-9 scale? Usually, this type of scale uses 1-5 which is amply enough. And why do you need to start with 0 rather than 1?
Joseph
Joseph Rézeau-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд José Ángel Polo -

Teachers should be evaluated by students anonymously on a scale of 0 to 10. A quality audit required it. I wish someone could help me.

Thank you in advance.

José Ángel Polo-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг
You could always tell your quality audit that rating teachers on a 0 to 10 scale does not make much sense.
José Ángel Polo-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд Itamar Tzadok -
If the results go to Excel (Fig 3) you should be able to use formulas to shift the numbers from 1-11 to 0-10 and adjust any corresponding calculations (until a real solution becomes available, that it). So if you have an Excel template with proper formulas you can copy the data from the exported Excel into the template.

I wonder if it should be courses rather than teachers that should be evaluated by students. But it may just be a terminological issue and in any case beside the point.

инээмсэглэл

Itamar Tzadok-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд José Ángel Polo -

Just need to subtract one to all values in the downloadable xls (now we do the survey module and manually subtract). How could this "transformation" from the template / code? Thanks.

José Ángel Polo-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд Itamar Tzadok -
I don't have this module so I don't know what exactly the export xls contains. But suppose the data you export is columns A-K (Fig 3). In the xls template you leave these columns empty. Then you add to cell L2 the formula =J2-1 and to cell M2 the formula =K2-1 and copy these two cells down to 999 or whatever number that suits your needs (if you prefer the copying may be done in the xls instance rather than the template). Set the background of these cells to grey so as to mark them as calculated. Now you open a new instance of the template, then you copy from the downloaded questionnaire data columns A-K and paste them into columns A-K in the xls report. Columns L and M will display the shifted values. All that remains is to do the statistics on columns M and L rather than J and K (of course you can also implement the statistics in the xls template so that as soon as you paste the data you get the statistics). Hope this helps. инээмсэглэл
Itamar Tzadok-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд José Ángel Polo -

Hi Itamar

I believe that at the end of the source code of the attachment (download.php) where the lines are printed in the xls data.

Could you help me to subtract 1 from all these values? Thank you very much.

// Print all the lines of data.

foreach ($results as $user => $rest) {

if (! $u = get_record("user", "id", $user)) {

error("Error finding student # $user");

}

echo $survey->id."\t";

echo strip_tags(format_string($survey->name,true))."\t";

echo $user."\t";

echo $u->firstname."\t";

echo $u->lastname."\t";

echo $u->email."\t";

echo $u->idnumber."\t";

echo userdate($results["$user"]["time"], "%d-%b-%Y %I:%M:%S %p")."\t";

foreach ($order as $key => $qid) {

$question = $questions["$qid"];

if ($question->type == "0" || $question->type == "1" || $question->type == "3" || $question->type == "-1") {

echo $results["$user"]["$qid"]["answer1"]." ";

}

if ($question->type == "2" || $question->type == "3") {

echo $results["$user"]["$qid"]["answer2"]." ";

}

}

echo "\n";

}

exit;

José Ángel Polo-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг

Sorry, José, but the download.php file you attached belongs to the survey module, not the questionnaire module.

If it's OK for you to hack your Questionnaire files, here is how you can get the ratings to start at zero. In file questionnaire/locallib.php, version $Id: locallib.php,v 1.49.2.66 2009/12/26 10:29:30 joseph_rezeau Exp $

line 1371

change

if (is_numeric($q4)) {
$q4++;
}

to

if (is_numeric($q4)) {
$q4;
}

Joseph
Joseph Rézeau-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд José Ángel Polo -

Joseph, thank you for your invaluable help.

The downloadable ods now has the scale as we have demanded them (Fig. 2).
Could it happen the same way in the results column of the questionnaire (Fig 1)?.
Thanks for everything.

Fig.1: column results

Questionnaire Module


Fig.2: downloadable ods

Questionnaire Module

José Ángel Polo-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг

Hello José,

1- In my previous message, the hack should really be (just comment out that line):

In file questionnaire/locallib.php, version $Id: locallib.php,v 1.49.2.66 2009/12/26 10:29:30 joseph_rezeau Exp $

line 1371

change

if (is_numeric($q4)) {
$q4++;
}

to

if (is_numeric($q4)) {
//$q4++;
}

2- Further hacks needed to display correctly in View all responses (your Fig.2)

In file questionnaire/questiontypes/questiontypes.class.php

$Id: questiontypes.class.php,v 1.31.2.44 2009/12/26 10:29:29 joseph_rezeau Exp $

line 542 change

$sql = 'SELECT C.content, AVG(A.rank+1) AS average '.

to

$sql = 'SELECT C.content, AVG(A.rank) AS average '.

lines 1920-1924 change

if (($j = $avg * $width) > 0) {
$interval = 50 / $length;
$out .= sprintf('<img alt="" src="'.$image_url.$currhbar.
'rhbar.gif" height="0" width="%d%%" style="visibility:hidden" />', $j - $interval - 0.3);
}

to

if (($j = $avg * $width) >= 0) {
$interval = 50 / $
$out .= sprintf('<img alt="" src="'.$image_url.$currhbar.
'rhbar.gif" height="0" width="%d%%" style="visibility:hidden" />', $j + $interval - 0.3);
}

Example

question's possible answers:

objetivos=1. Existe correspondencia entre objetivos y contenidos de la accion formativa
documentacion=2. La documentacion y materiales ... son comprensibles y adecuados.
medios=3. Los medios y soportes digitales son adecuados.
1=0
2=1
3=2
4=3
5=4
6=5
7=6
8=7
9=8
10=9
11=10

See attached Result display (for one response only) and export to Excel

Please test my hacks carefully on a test installation before going live! I will try to find a better solution and commit it as an option for 0 -> n / 1 -> n ratings in the Rate question Edit screen.

Joseph

Хавсралт image00.jpg
Joseph Rézeau-н хариуд

Re: Change Question type 1..N to Question type 0..N

дэргэд José Ángel Polo -

Joseph, after hacking as indicating to me everything seems ok: the results column shows the value of the marked response, and downloadable ods respects. You've helped me to change the scale 1 .. N to 0 .. N

Thank you very much for everything. Best Regards.


Questionnaire


Questionnaire


Questionnaire