Project

General

Profile

Bug #7895

Error when duplicating question of type 11 (Multiple true/false/don't know)

Added by Nicolas Ducoulombier almost 4 years ago. Updated almost 4 years ago.

Status:
Bug resolved
Priority:
Normal
Category:
Exercises
Target version:
Start date:
13/10/2015
Due date:
% Done:

0%

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

Description

When duplicating a question of type 11 (Multiple true/false/don't know) result in an error.

There is an example in this exercise:
https://unstable.chamilo.org/main/exercice/admin.php?cidReq=TESTSCORM&id_session=0&gidReq=0&gradebook=0&origin=&id_session=0&exerciseId=104

when duplicating the answer it opens this page:
https://unstable.chamilo.org/main/exercice/admin.php?cidReq=TESTSCORM&id_session=0&gidReq=0&gradebook=0&origin=&clone_question=909

And it ends with this error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4' for key 'PRIMARY'' in /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 66 PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4' for key 'PRIMARY' in /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 91 Call Stack: 0.0010 363800 1. {main}() /var/www/unstable.chamilo.org/www/main/exercice/admin.php:0 0.2196 9129528 2. Question->duplicate() /var/www/unstable.chamilo.org/www/main/exercice/admin.php:256 0.2228 9185480 3. Database::insert() /var/www/unstable.chamilo.org/www/main/exercice/question.class.php:1329 0.2228 9187936 4. Doctrine\DBAL\Statement->execute() /var/www/unstable.chamilo.org/www/main/inc/lib/database.lib.php:397 0.2229 9187984 5. Doctrine\DBAL\Driver\PDOStatement->execute() /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php:165 0.2229 9188032 6. PDOStatement->execute() /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:91 Doctrine\DBAL\Driver\PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4' for key 'PRIMARY' in /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 93 Call Stack: 0.0010 363800 1. {main}() /var/www/unstable.chamilo.org/www/main/exercice/admin.php:0 0.2196 9129528 2. Question->duplicate() /var/www/unstable.chamilo.org/www/main/exercice/admin.php:256 0.2228 9185480 3. Database::insert() /var/www/unstable.chamilo.org/www/main/exercice/question.class.php:1329 0.2228 9187936 4. Doctrine\DBAL\Statement->execute() /var/www/unstable.chamilo.org/www/main/inc/lib/database.lib.php:397 0.2229 9187984 5. Doctrine\DBAL\Driver\PDOStatement->execute() /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php:165 Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO c_quiz_question_option (iid,c_id,question_id,name,position) VALUES (:iid, :c_id, :question_id, :name, :position)' with params ["4", "41", "910", "True", "1"]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4' for key 'PRIMARY' in /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 66 Call Stack: 0.0010 363800 1. {main}() /var/www/unstable.chamilo.org/www/main/exercice/admin.php:0 0.2196 9129528 2. Question->duplicate() /var/www/unstable.chamilo.org/www/main/exercice/admin.php:256 0.2228 9185480 3. Database::insert() /var/www/unstable.chamilo.org/www/main/exercice/question.class.php:1329 0.2228 9187936 4. Doctrine\DBAL\Statement->execute() /var/www/unstable.chamilo.org/www/main/inc/lib/database.lib.php:397 

Associated revisions

Revision 29f00d51 (diff)
Added by Julio almost 4 years ago

Fix query see #7895

History

#1

Updated by Nicolas Ducoulombier almost 4 years ago

I think it's the same problem, but to remember to test it aswell when the first one is corrected I indicate it aswell.

Copying the exercise there is as well an error:

Example of exercise to copy: https://unstable.chamilo.org/main/exercice/exercise.php?cidReq=TESTSCORM&id_session=0&gidReq=0&gradebook=0&origin=

link of the action: https://unstable.chamilo.org/main/exercice/exercise.php?cidReq=TESTSCORM&id_session=0&gidReq=0&gradebook=0&origin=&choice=copy_exercise&sec_token=2fd228018258cfbc7d908bd96756a652&exerciseId=104

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4' for key 'PRIMARY'' in /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 66 PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4' for key 'PRIMARY' in /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 91 Call Stack: 0.0029 610552 1. {main}() /var/www/unstable.chamilo.org/www/main/exercice/exercise.php:0 0.5147 17216984 2. Exercise->copy_exercise() /var/www/unstable.chamilo.org/www/main/exercice/exercise.php:267 0.5431 18025336 3. Question->duplicate() /var/www/unstable.chamilo.org/www/main/exercice/exercise.class.php:1773 0.5455 18032000 4. Database::insert() /var/www/unstable.chamilo.org/www/main/exercice/question.class.php:1329 0.5455 18034456 5. Doctrine\DBAL\Statement->execute() /var/www/unstable.chamilo.org/www/main/inc/lib/database.lib.php:397 0.5456 18034504 6. Doctrine\DBAL\Driver\PDOStatement->execute() /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php:165 0.5456 18034552 7. PDOStatement->execute() /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:91 Doctrine\DBAL\Driver\PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4' for key 'PRIMARY' in /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 93 Call Stack: 0.0029 610552 1. {main}() /var/www/unstable.chamilo.org/www/main/exercice/exercise.php:0 0.5147 17216984 2. Exercise->copy_exercise() /var/www/unstable.chamilo.org/www/main/exercice/exercise.php:267 0.5431 18025336 3. Question->duplicate() /var/www/unstable.chamilo.org/www/main/exercice/exercise.class.php:1773 0.5455 18032000 4. Database::insert() /var/www/unstable.chamilo.org/www/main/exercice/question.class.php:1329 0.5455 18034456 5. Doctrine\DBAL\Statement->execute() /var/www/unstable.chamilo.org/www/main/inc/lib/database.lib.php:397 0.5456 18034504 6. Doctrine\DBAL\Driver\PDOStatement->execute() /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php:165 Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO c_quiz_question_option (iid,c_id,question_id,name,position) VALUES (:iid, :c_id, :question_id, :name, :position)' with params ["4", "41", "915", "True", "1"]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4' for key 'PRIMARY' in /var/www/unstable.chamilo.org/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 66 Call Stack: 0.0029 610552 1. {main}() /var/www/unstable.chamilo.org/www/main/exercice/exercise.php:0 0.5147 17216984 2. Exercise->copy_exercise() /var/www/unstable.chamilo.org/www/main/exercice/exercise.php:267 0.5431 18025336 3. Question->duplicate() /var/www/unstable.chamilo.org/www/main/exercice/exercise.class.php:1773 0.5455 18032000 4. Database::insert() /var/www/unstable.chamilo.org/www/main/exercice/question.class.php:1329 0.5455 18034456 5. Doctrine\DBAL\Statement->execute() /var/www/unstable.chamilo.org/www/main/inc/lib/database.lib.php:397 
#2

Updated by Julio Montoya almost 4 years ago

  • Status changed from Assigned to Needs more info
  • Assignee changed from Julio Montoya to Nicolas Ducoulombier

Nicolas Ducoulombier wrote:

I think it's the same problem, but to remember to test it aswell when the first one is corrected I indicate it aswell.

Copying the exercise there is as well an error:

Example of exercise to copy: https://unstable.chamilo.org/main/exercice/exercise.php?cidReq=TESTSCORM&id_session=0&gidReq=0&gradebook=0&origin=

link of the action: https://unstable.chamilo.org/main/exercice/exercise.php?cidReq=TESTSCORM&id_session=0&gidReq=0&gradebook=0&origin=&choice=copy_exercise&sec_token=2fd228018258cfbc7d908bd96756a652&exerciseId=104

[...]

Fixed now.

#3

Updated by Yannick Warnier almost 4 years ago

  • Category set to Exercises
  • Target version set to 1.10.0
#4

Updated by Nicolas Ducoulombier almost 4 years ago

  • Status changed from Needs more info to Bug resolved

It's all good.

Also available in: Atom PDF