Project

General

Profile

Feature #5715

Select several categories by question

Added by Yannick Warnier almost 7 years ago. Updated over 3 years ago.

Status:
Needs testing
Priority:
Urgent
Assignee:
-
Category:
Exercises
Target version:
Start date:
12/11/2012
Due date:
% Done:

50%

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

Description

In the question form, we can select the category. However, there should be a possibility to select several categories in one shot, with a multiple select.

Implement the multiple select and make sure the classes/methods behind it enable picking several categories at the same time.

This should go into Chamilo 1.9.4 as it shouldn't require any database change.

Associated revisions

Revision c7e5752e (diff)
Added by Julio Montoya almost 7 years ago

Merging from 1.9.x + allowing multiple categories per question see #5715

Revision 79bad158 (diff)
Added by Julio Montoya almost 7 years ago

Adding autoincrement id in table "c_quiz_question_rel_category" to supporting several categories per question see #5715

History

#1

Updated by Julio Montoya almost 7 years ago

  • Target version changed from 1.9.4 to 2.0

The table:

mysql> describe c_quiz_question_rel_category;
+-------------+---------+------+-----+---------+-------+
| Field       | Type    | Null | Key | Default | Extra |
+-------------+---------+------+-----+---------+-------+
| c_id        | int(11) | NO   | PRI | NULL    |       |
| question_id | int(11) | NO   | PRI | NULL    |       |
| category_id | int(11) | NO   |     | NULL    |       |
+-------------+---------+------+-----+---------+-------+
3 rows in set (0.00 sec)

Needs an id in order to allow multiple categories.

I'm moving this to 1.10

I also suggest to move this to 1.10 in order to leave the exercise code as stable as possible at least for the 1.9.x series

#2

Updated by Julio Montoya almost 7 years ago

  • Status changed from Assigned to Needs testing
  • % Done changed from 0 to 50
#4

Updated by Yannick Warnier almost 7 years ago

Julio A. Montoya wrote:

I also suggest to move this to 1.10 in order to leave the exercise code as stable as possible at least for the 1.9.x series

Good for me.

#5

Updated by Hubert Borderiou almost 7 years ago

How does it work if you have a test using random question by categories and if a question own of 2 categories ?

Question 1 : 1+1=? [category Math]
Question 2 : mc²=? [category PHYSIC]
Question 3 : c=300000km/s ; c²=? [category MATH] [category PHYSIC]

If I create a test random by category with 1 question of each category, I'll have 1 MATH question and 1 PHYSIC question. It is important not to have a test with twice question 3.

#6

Updated by Yannick Warnier almost 7 years ago

Julio, the unique ID was not really necessary, was it? Is that for the ORM or something like that?

#7

Updated by Yannick Warnier almost 7 years ago

If you have a test with random categories and one question belongs to 2 categories, then the first ocurrence of this question puts the question ID in an "exceptions" array which ensures it will only be found in the first category where it had to appear. There no other way I can think of.

#8

Updated by Julio Montoya almost 7 years ago

Yannick Warnier wrote:

Julio, the unique ID was not really necessary, was it? Is that for the ORM or something like that?

yes it was necessary, mysql prompted me errors when trying to insert several categories for a question the problem was in the primary key.

#9

Updated by Yannick Warnier almost 7 years ago

Julio A. Montoya wrote:

Yannick Warnier wrote:

Julio, the unique ID was not really necessary, was it? Is that for the ORM or something like that?

yes it was necessary, mysql prompted me errors when trying to insert several categories for a question the problem was in the primary key.

It seems strange to me, as the combination of category+question should be unique by itself, so it shouldn't be a problem for the primary key.
Like:
Category Question
3 5
3 6
4 5
5 5

-> there's never a problem with question 5 being part of categories 3,4 and 5 at the same time, or is there???

#10

Updated by Yannick Warnier almost 7 years ago

This being said, I don't mind. At all. It just seemed strange to me.

#11

Updated by Julio Montoya almost 7 years ago

  • Assignee deleted (Julio Montoya)

Yannick Warnier wrote:

This being said, I don't mind. At all. It just seemed strange to me.

This was the old structure:

$sql = "CREATE TABLE `".$table_quiz_question_rel_category . "` (
$add_to_all_tables
question_id int NOT NULL,
category_id int NOT NULL,
PRIMARY KEY (c_id,question_id)
)" . $charset_clause;
Database::query($sql);

So according to this you can't have 2 keys with the same "c_id" and "question_id" that was the reason it failed before.

#12

Updated by Yannick Warnier over 3 years ago

  • Target version changed from 2.0 to 3.0

Also available in: Atom PDF