Project

General

Profile

Feature #5714

Visual questions categories

Added by Yannick Warnier about 6 years ago. Updated almost 3 years ago.

Status:
Assigned
Priority:
High
Assignee:
Category:
Exercises
Target version:
Start date:
12/11/2012
Due date:
14/11/2012
% Done:

30%

Estimated time:
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

In order to enable a teacher to setup several questions which ask something about a specific text, we need the notion of "visual" category. That is, when several questions are marked as part of one specific category, they should appear together after the description of the category.

For example:

  • Title of the category (from the c_quiz_question_category.title field)
  • Text of the category (from the c_quiz_question_category.description field)
    • Title of 1st question
      • Description of 1st question
      • Answers of 1st question
      • Save & continue button
    • Title of 2nd qustion
      • Desc of 2nd question
      • Answers of 2nd question
      • Save & continue button
    • etc
  • Maybe one question without category here
  • Submit button

This implies adding a "type" field to the c_quiz_question_category table (0 when normal, one when "visual" category).

When using a random exercise, if one of the questions of a specific visual category is picked, then all the questions of this visual category (randomly picked) must be grouped together after the category's description.

The creation of a new category should have an additional field ("Normal" = 0 by default, and "Visual" = 1 as a first option).

The creation of a question allows the teacher to select categories. Visual categories are marked with an *, and a legend describes what it does:
  • Categories marked with a * are visual categories, used to group together questions about the same text, the same audio or the same content in general.

We need this for a demo at the Ministry of Education. See the due date (which is previous to the demo). It should be included directly into the 1.10 code.


Files

snapper1166187321534.png (61.7 KB) snapper1166187321534.png Yannick Warnier, 14/11/2012 08:34
media_example.png (21.7 KB) media_example.png Julio Montoya, 15/11/2012 12:36

Associated revisions

Revision 91da5b87 (diff)
Added by Julio Montoya about 6 years ago

Creating a render_question_list() function in exercise_submit in order to move code into a function see #5714

Revision 9b10817b (diff)
Added by Julio Montoya about 6 years ago

Basic question funcionality based in "medias" see #5714

Revision fd6ea4b6 (diff)
Added by Julio Montoya about 6 years ago

Fixing icons when doing an exercise see #5714

Revision a3cb652b (diff)
Added by Julio Montoya about 6 years ago

Adding add/edit medias see #5714

Revision 696acfa0 (diff)
Added by Julio Montoya about 6 years ago

Ordering question depending in the media see #5714

Revision 0a8def74 (diff)
Added by Julio Montoya about 6 years ago

Ordering question depending in the media see #5714

Revision dcbbbcf7 (diff)
Added by Julio Montoya about 6 years ago

Exercise report: ordering question depending in the media see #5714

Revision c26979ad (diff)
Added by Julio Montoya about 6 years ago

Fixing categories when using random for categories see #5714

History

#1

Updated by Julio Montoya about 6 years ago

  • Status changed from Assigned to Needs more info
  • Assignee changed from Julio Montoya to Yannick Warnier

Yannick Warnier wrote:

In order to enable a teacher to setup several questions which ask something about a specific text, we need the notion of "visual" category. That is, when several questions are marked as part of one specific category, they should appear together after the description of the category.

ok

For example:

  • Title of the category (from the c_quiz_question_category.title field)
  • Text of the category (from the c_quiz_question_category.description field)
    • Title of 1st question
      • Description of 1st question
      • Answers of 1st question
      • Save & continue button
    • Title of 2nd qustion
      • Desc of 2nd question
      • Answers of 2nd question
      • Save & continue button
    • etc
  • Maybe one question without category here
  • Submit button

Some questions:

1. What happen if you have 1 question with a category but with no "visual mode"?

2. What happen if you have another exercise but you don't want that order but you want to use that category? (you want the classic chamilo order)? You're forced to use the "visual mode" for that category!

This implies adding a "type" field to the c_quiz_question_category table (0 when normal, one when "visual" category).

I think is better if we add an option in the exercise table to group questions by category.

Group by: (X) Category --> by category like your example
() Question --> Normal

If that's the case the question list should be modified in order to allow "drag n drop" categories.

When using a random exercise, if one of the questions of a specific visual category is picked, then all the questions of this visual category (randomly picked) must be grouped together after the category's description.

I think this is very tricky to do and it will break the current behavior of categories. Right now we have an order option:

Random questions by category:

() Yes, with categories shuffled
() Yes, with categories ordered
() No

So is up to you how random questions will be parsed. If you select the 2nd option then we could show the category as you show in the example.

The creation of a new category should have an additional field ("Normal" = 0 by default, and "Visual" = 1 as a first option).

The creation of a question allows the teacher to select categories. Visual categories are marked with an *, and a legend describes what it does:
  • Categories marked with a * are visual categories, used to group together questions about the same text, the same audio or the same content in general.

We need this for a demo at the Ministry of Education. See the due date (which is previous to the demo). It should be included directly into the 1.10 code.

#2

Updated by Julio Montoya about 6 years ago

One other question: What happen if you have 1 question with 2 categories? see #5715

#3

Updated by Yannick Warnier about 6 years ago

  • Priority changed from Urgent to High

Julio A. Montoya wrote:

1. What happen if you have 1 question with a category but with no "visual mode"?

The non-visual categories do not appear in any way in the exercises, so you can just ignore them (just "select * from c_quiz_question_category where c_id = 123 and type=1)

2. What happens if you have another exercise but you don't want that order but you want to use that category? (you want the classic chamilo order)? You're forced to use the "visual mode" for that category!

Yes, the "visual category" has priority on everything else. I know it's not ideal for now, but people who don't need it won't use it, so it's OK to test it out in 1.9.4 (then we'll improve in the next iteration).

This implies adding a "type" field to the c_quiz_question_category table (0 when normal, one when "visual" category).

I think is better if we add an option in the exercise table to group questions by category.

Group by: (X) Category --> by category like your example
() Question --> Normal

If that's the case the question list should be modified in order to allow "drag n drop" categories.

No. This cannot be. There is a need for both "visual" and "non-visual" categories. Actually the "visual" categories should be called "question groups".
Let me give you a (real-life) example:

I have a test with 60 questions.
  • 20 of them are about maths logic
  • 20 of them are about language understanding
  • 20 of them are about social behaviour

I don't want the questions to be grouped by these categories. I just want the report to tell me how well each student did in each category (which is very important for entry exams in universities, for example, as some categories might have a value (ponderation) higher than others).

Within the 20 questions on language understanding, I have 5 questions which are about the same text. It's a 50-lines long text, so I don't want my student to get the first question with the text, then pass 3 mathematical questions, then again the same 50-lines text with another question. The student will always wonder if there isn't something different in this version of the text and will have to read it again, which will make him loose time.

In the latter case, we need a way to "group" these questions together.

The drag&drop feature by category would be nice, but it doesn't work because one question could be located in 2 different categories (not visual categories) at the same time.

As I'm writing this, I realize we should probably have another type of relationship indeed. See below for the notion of "parent question".

When using a random exercise, if one of the questions of a specific visual category is picked, then all the questions of this visual category (randomly picked) must be grouped together after the category's description.

I think this is very tricky to do and it will break the current behavior of categories. Right now we have an order option:

Random questions by category:

() Yes, with categories shuffled
() Yes, with categories ordered
() No

So is up to you how random questions will be parsed. If you select the 2nd option then we could show the category as you show in the example.

Right, I had forgotten about this option. Then really, we need another entity.
What about adding a "parent question" then? (in c_quiz_question)
This would allow us to consider one question as inseparable from its sub-questions.

#4

Updated by Julio Montoya about 6 years ago

I more confused with your last comment some basic questions:

1. What's the difference between "visual" and "non visual" categories?

What I think right now is:

Non visual cats:

The question list is ordered depending in the order established by the teacher field: c_c_quiz_rel_question.question_order
Example:

q1 -> cat 1
q2 -> cat 2
q4 -> cat 1
q3 -> cat 2

For visual cats:

The questions will be ordered depending the category.

Cat 1
q1
q4

Cat 2
q2
q3

The Cat 1 and Cat 2 position order should be handle some way.... probably another table or relying in the c_c_quiz_rel_question.question_order but fixed for categories.

That's right?

2. Why don't just add a setting in the exercise to treat categories with a "visual" or "non visual" approach.

This setting will change the behaviour as explained in 1.

3. Reports (exercise results) will be handle the same way for "visual" and "non visual" categories. A graph should be added something like:

A chart or pie graph something like this:

Student: Julio Montoya

Cat 1 0 ---------> 100% :)
Cat 2 0 ---> 30% :(

#5

Updated by Hubert Borderiou about 6 years ago

This was the goal of categories I've added.
It is call in french "Test de positionnement", in egnlish "Placement test".

#6

Updated by Yannick Warnier about 6 years ago

Julio A. Montoya wrote:

I am more confused with your last comment. Some basic questions:

1. What's the difference between "visual" and "non visual" categories?

What I think right now is:

Non visual cats:

The question list is ordered depending on the order established by the teacher, field c_quiz_rel_question.question_order
Example:

q1 -> cat 1
q2 -> cat 2
q4 -> cat 1
q3 -> cat 2

For visual cats:

The questions will be ordered depending the category.

Cat 1
q1
q4

Cat 2
q2
q3

The Cat 1 and Cat 2 position order should be handle some way.... probably another table or relying in the c_c_quiz_rel_question.question_order but fixed for categories.

That's right?

Yes, but it makes it more complicated.
My last suggestion about forgetting about "visual categories" and using, instead, parent questions, is because it makes it much easier to organize.

Hubert suggested we even call it "Media" as a special question type, where there is no answer, just a media (text, image, sound or video). Then you define other (normal) questions and, inside these normal questions, in the "advanced" section, you say "Attach to media: " and you give a select box with the different "media" questions available in this exercise.

Then when generating the exercise, you have 2 cases:
  • pre-selected order: if you put two different questions using the same media in the exercise, the questions are automatically grouped (there is no way to separate them), and the media is put before those 2 questions.
  • random order: if some of the questions that go with the media are picked (randomly) in the same exercise, they are put together. So you fist generate the full list of random questions, then you do a foreach and identify which ones have the same media. If several questions have the same media, then show the media then the questions, all together. A media-type question is never selected as a question. It only appears in an exercise if there is another question that references it.

2. Why don't just add a setting in the exercise to treat categories with a "visual" or "non visual" approach.

This setting will change the behaviour as explained in 1.

I don't think (anymore) that it is a good idea to use the same notion of category. These are two completely different things. For these question groups, I don't care at all if there is a grouped reporting or something like that. I just want to show the questions together after the media in the exercise.

3. Reports (exercise results) will be handle the same way for "visual" and "non visual" categories. A graph should be added something like:

A chart or pie graph something like this:

Student: Julio Montoya

Cat 1 0 ---------> 100% :)
Cat 2 0 ---> 30% :(

No. I don't want visual categories in the report. Only non-visual ones.
But yes, the table (of normal categories, not visual) should be something like the attached image (without having to be so advanced)

#7

Updated by Julio Montoya about 6 years ago

  • Status changed from Needs more info to Assigned
  • % Done changed from 0 to 20

I added an option to add a media, and attach media to a question, I already sent some code

#8

Updated by Julio Montoya about 6 years ago

  • Status changed from Assigned to Needs more info

When dealing with options like "all in one page" and "question per page", in fact I'm going to do that for medias.

So the setting will change the "normal" behaviour so: "all medias in 1 page" and "1 media per page", because questions inside a media can't be showed separately according with your description.

#9

Updated by Julio Montoya about 6 years ago

  • % Done changed from 20 to 30

I have something really basic, you can add "medias", you can attach a question to a media.

When creating an exercise, do not change the default values, (random, one q per page/all questions in page, nada) because I didn't test it yet.
Then when doing an exercise you will see that now the questions are showed grouped by "Media" the title and description are showed.

There's no possibility of editing a media so when creating a media make sure you have the final content there.

I didn't finish the report yet.

#11

Updated by Yannick Warnier about 6 years ago

  • Status changed from Needs more info to Assigned
  • Assignee changed from Yannick Warnier to Julio Montoya

OK, let's retake this.

When trying it out, we saw that the first attempts where kind of weird... (the questions with the same media were not shown together and the media was not shown).

Please continue developing this, starting with the capability to edit media.

As specified in other tasks, the report by categories should not be based on visual categories (but it should be based on normal categories, so it still has to be developed).

To get back to visual categories, I would like to focus on the random order.

You previously asked how it should work, so this is an example.

Let's imagine we have 10 questions, from 1 to 10, with media A and B.
Questions 1,2 and 3 belong to media A.
Questions 4 and 5 belong to media B.
Questions 6 to 10 are "free" (not attached to any media).

The random order for these 10 questions would normally be: 4,7,2,1,9,3,6,2,5,8,10

On the basis of this order, the logic would be something in the direction of the following:

$order = array(4,7,2,1,9,3,6,2,5,8,10);
$medias = array(0=>array(1,2,3), 1=>array(4,5));
$new_order = array();
foreach ($order as $id => $q) {
  foreach ($medias as $idm => $qm) {
    if (in_array($q,$qm)) {
      // this question has a media as a parent
    } else {
      // this question doesn't have a media parent
      $new_order[$id] = $q;
    }
  }
}

(or it could also be the contrary and check for the media in each question...)

In the end, we just generate an ordered list of questions, and when reproducing them, we check for each question if there is a media attached to it. If there is and this is the first of the questions for this media, we show the media and the question, then we continue in the loop and show all the questions (on the same page) for the same media until the media changes (to null or to another media).
If null, we show the question and the buttons to go to the next page. If not null, we show the media and the question, then look for the following questions to see if this is the same media.

$last_parent = null;
foreach ($order as $id => $q) {
  if (!empty($q->parent)) {
    if ($q->parent != $last_parent) {
      //show the media and the question
      $q->parent->show();
      $q->show();
      $last_parent = $q->parent;
    } else {
      $q->show();
    }
  } else {
    $q->show();
  }
}

#12

Updated by Julio Montoya about 6 years ago

I supposed you updated your DB?

#13

Updated by Julio Montoya about 6 years ago

  • Assignee changed from Julio Montoya to Yannick Warnier

It's not clear enough:

If there is and this is the first of the questions for this media, we show the media and the question, then we continue in the loop and show all the questions (on the same page) for the same media until the media changes (to null or to another media).

For the sentence above I understand that:

1. If I don't find the first element of the media I show the question as a normal question example:
Example: this is my question list randomized: 2,4,5,6,7,8,9,10,1,3. I asume for this example that media B doesn't exist

2, 1 question
4, 1 question
5, 1 question
6, 1 question
7, 1 question
8, 1 question
9, 1 question
10, 1 question
(1,3) Media A

2. If I have elements of the group "A" at the beginning and at the end of the question list the first group will be showed and the second group will be showed as simple questions.
Example: this is my question list randomized: 1,2,4,5,6,7,8,9,10,3. I asume for this example that media B doesn't exist
So the question list will be show like this:

(1,2) Media A
4, 1 question
5, 1 question
6, 1 question
7, 1 question
8, 1 question
9, 1 question
10, 1 question
3, 1 question

I think this is not right or you wrote too fast.
So, for your example I asume that you wanted the order like this: I also asume that both media A and B exists
Question list randomized: 4,7,2,1,9,3,6,2,5,8,10

(4,5) Media B
7, 1 question
(1,2,3) Media A
9,
6,
8,
10

The question here is that elements inside a media will be randomized too?

It will be very useful if you show examples as I'm showing right now randomized question list and how the page will be rendered.

#14

Updated by Yannick Warnier about 6 years ago

  • Assignee changed from Yannick Warnier to Julio Montoya

I think I was clear, actually.

You have to make two runs through the array:
  • the first one to get the classical random order (without including the "media" items)
  • the second one to group the questions together, so for the second one you would do something like this (retaking your last example):
    $random1 = (4,7,2,1,9,3,6,2,5,8,10);
    for ($i=0; $i<count($random1); $i++) {
      $q1 = new question($random1[$i]);
      if (!empty($q->parent)) {
        for ($j=$i+1; $j<count($random1); $j++) {
          $q2 = new question($random1[$j]);
          if ($q2->parent == $q1->parent && $j>$i+1) {
            $random1 =& permutation($random1,$i+1,$j);
          }
        }
      }
    }
    function permutation(&$array,$index1, $index2) {
      $tmp = $array[$index1];
      $array[$index1] = $array[$index2];
      $array[$index2] = $tmp;
      return $array;
    }
    

    (I think this algorithm might have a flaw and cause an infinite loop somewhere in the 2nd level "for()" loop, but the big idea is there).

So in the end, you should obtain a final semi-random array of ((4,5),7,(2,1,3),9,6,8,10) from an initial fully random array of (4,7,2,1,9,3,6,5,8,10) (this is assuming that 1,2,3 use Media A and 4,5 use Media B.

#15

Updated by Yannick Warnier almost 3 years ago

  • Target version changed from 2.0 to 3.0

Also available in: Atom PDF