Feature #6813

Allow FILL_IN_BLANKS to support multiple rules to match teacher Correct Answer

Added by Miguel José Amez Riendas about 6 years ago. Updated almost 4 years ago.

Needs testing
Target version:
Start date:
Due date:
% Done:


Estimated time:
2.00 h
SCRUM pts - complexity:


We are working with Chamilo in our Academy and we are receiving several complains about Fill in the Blanks' exercises:
1. If teacher has written in capital letters, maybe the students would write in lower.
2. Punctuation on answers is a little bit hard-to-understand by the computer, and the student could write a correct answer that the machine missunderstood...
3. dual-blanks are getting teachers crazy also.
4. If a student writes a not-so-different variant of the correct answer, maybe the teacher, on the edition/validation screen would like to change that answer to correct.
5. Multi-optional answers should be considered also (e.g: throusers or pants could be the right answer to a photo).

Apart from this, I think that adding a new private function to the Exercise class that checks the rules applied to specific blanks could be very interesting. This way, on the FILL_IN_BLANKS section of the manage_answer function, we could check the rules that make the answer of the student to an specific blank correct, and maybe, in the future, a plugin-architecture could be created wrapping this concept and let teachers to write their own rules easily, or creating an easy interface to enable/disable detailed rules.

I've fixed the first 5 points on our Chamilo 1.9.6 installation, and I'm uploading here my fix.
the following files should be patched:
1. /main/exercice/
2. /main/exercice/exercise.class.php

Hope this helps


exercise.class.php (190 KB) exercise.class.php Miguel José Amez Riendas, 08/11/2013 10:33
exercise_report.php (21.2 KB) exercise_report.php Miguel José Amez Riendas, 08/11/2013 10:33
exercice_FILL_IN_BLANKS.rar (88.2 KB) exercice_FILL_IN_BLANKS.rar Miguel José Amez Riendas, 02/04/2014 10:08



Updated by Yannick Warnier almost 6 years ago

  • Status changed from New to Assigned
  • Assignee set to Julio Montoya
  • Priority changed from High to Normal
  • Target version set to 1.9.8
  • Estimated time changed from 1.00 h to 2.00 h
  • Complexity changed from Piece of cake to Normal

Hi Miguel, thank you for your contribution.

Just a few comments...
Priority and Complexity are not to be defined from the user perspective, but from the packager perspective. We left the field present so that users we know can set a priority/complexity if they have previously confirmed it on IRC, but as indicated in the rules for reporting bugs, you are required to leave this to its default value.
Complexity (and estimated time) is relative to the final integration into Chamilo, not only on integrating your changes, but in reviewing your code to avoid unprobable security flaws, code not matching our Coding conventions, adding new interface elements, translating to our main languages (en/es/fr), etc

Regarding your contribution:
Although I agree that, in a majority of cases, your points are correct for most teachers (probably 99%), there are cases where teachers want uppercase, proper punctuation and normal number of blanks). I believe it is correct to add your contribution by default, though, and maybe we should add options in the future to allow for more strictness.

Could you please detail here the "split" character you chose to differentiate between multiple alternatives inside a single field?
We should avoid blocking the use of any character that might be used in a normal (single) answer.

It will, however, have to be altered with some text explaining the rules to the teachers.

I'm assigning this to Julio for review and integration.

Julio, please add two variables:
$ExerciseFillBlanksRulesTitle = "Rules";
$ExerciseFillBlanksRulesComment = "Students can: answer in lower or uppercase letters, unintentionally add more blanks than required and use alternative punctuation. Multiple possible alternatives can be added.";


Updated by Yannick Warnier almost 6 years ago

  • % Done changed from 80 to 50

Updated by Miguel José Amez Riendas almost 6 years ago

Hi Yannick,

Thanks for your answer. We reviewed more things about this issue, due to production experience. It makes things easier for the teacher, as it is more visual for him/her to know which answer has been corrected (approved) manually (by him/her, of course).
We've already fixed more problems with multi-anonymous users tests (anonymous tests answered by multiple people at the same time), and some problems we had with multi-answers tests (more than one fill in the blanks question in a test).

Tell me if you want me to update sources.



Updated by Yannick Warnier almost 6 years ago

Hi Miguel,

I would love to integrate improvements for the multi-anonymous tests, as this is a recurrent problem for many of our users


Updated by Miguel José Amez Riendas almost 6 years ago

Hi Yannick,

There are several files involved on multi-anonymous tests problems. Today I've got a lot of work, but I will try to upload all the files involved on FILL IN THE BLANKS and multi-anonymous this evening. Due to the problem of being hard-coupled problems, I won't open a new issue for multi-anonymous purpose. Sorry about it, but I don't have so much time these days.


Updated by Yannick Warnier almost 6 years ago

No problem. Just let us know when you have some time to look at it and send us whatever you feel comfortable sending.
In the meantime Julio can already check the part you already submitted.


Updated by Yannick Warnier almost 6 years ago

  • Status changed from Assigned to New
  • Assignee deleted (Julio Montoya)
  • Target version changed from 1.9.8 to 2.0

Moving to 1.10 in the meantime


Updated by Miguel José Amez Riendas almost 6 years ago

Hi Yanick,

Sorry (again and new on this issue... XDD).
I'm here with the hot changes. It is difficult to isolate the so-many-aspects we've modified (there are anonymous tests problems, FILL-IN-BLANKS aspects, ...).
I'll Try to sumarize the main aspects of my contribution on these files:
1. Change-to-correct issue: As a result of testing these months, we concluded that a teacher needed a button to consider as correct a specific fill-in-blanks answer from a student.
2. Problems with anonymous-concurrent exams are fixed.
3. Problems sending answers for questions with images inside is fixed. You need to modify a couple of tables on database for this to work propertly:
- table track_e_attempt -> need to change column answer from text to mediumtext
- table c_quiz_answer -> need to change column answer from text to mediumtext
4. Change extrange behaviours in fill-in-blanks.

There is also a chaotic behaviour with multiple-options in fill-in-blanks. I disabled this behaviour because we had sooooo many problems with it. It is pending for a solution.

We use a special mark when a teacher considers an answer as correct. We append "+@+" string (without double quotes, of course ;-) ) at the begining of a correct answer. This way, any considered-as-correct-by-teacher answer will count on the final student's score.

Hope this helps.


Updated by Yannick Warnier almost 4 years ago

  • Status changed from New to Needs testing
  • Target version changed from 2.0 to 3.0

I believe the multiple answers in fill-in-the-blanks were added by hborderiou in 1.10.
Not sure what we still need to integrate from your patch.

Also available in: Atom PDF