MantisBT

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005676ATutorImport Contentpublic2016-04-09 16:062016-06-30 17:43
Reportergreg 
Assigned Togreg 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version2.2.2Fixed in Version2.2.2 
Summary0005676: CC/QTI Import Multiple Answer
DescriptionWhen impoting a qti package or common cartidge, that has a multiple answer question in the test, it attempts to insert the same question ID twice. Appears to be occuring in the importQuestions() funciton in QTIImport.class.php
Steps To Reproduce[09-Apr-2016 22:00:14 Europe/Berlin] Duplicate entry '99-956' for key 'PRIMARY'
SQL: INSERT INTO AT_tests_questions_assoc(test_id, question_id, weight, ordering, required) VALUES (99, 956, 5, 5, 0)

April 9, 2016, 10:00 pm
array (
  0 => 953,
  1 => 954,
  2 => 955,
  3 => 956,
  4 => 956,
  5 => 957,
)
Additional Information                    //TODO: The groups is 1-0+ choices. So we should loop thru groups, not choices.
                    if (is_array($xml->choices[$loopcounter])){
                        foreach ($xml->choices[$loopcounter] as $choiceNum=>$choiceOpt){
                            if (sizeof($test_obj['groups'] )>0) {
                                if (!empty($xml->answers[$loopcounter])){
                                    foreach ($xml->answers[$loopcounter] as $ansNum=>$ansOpt){
                                        if ($choiceNum == $ansOpt){
                                            //Not exactly efficient, worst case N^2
                                            $test_obj['answers'][$ansNum] = $i;
                                        }
                                    }
                                }
                            } else {
                                //save answer(s)
                                if (is_array($xml->answers[$loopcounter]) && in_array($choiceNum, $xml->answers[$loopcounter])){
                                    $test_obj['answers'][] = $i;
                                }
                            }
                            $test_obj['choice'][] = $choiceOpt;
                            debug_to_log();
                            $i++;
                        }
                    }
TagsNo tags attached.
Affects versionSVN
SVN Revision#a08053f..f509461
Attached Files

- Relationships

-  Notes
(0007385)
greg (administrator)
2016-04-16 15:28

1d49cca..a08053f , but left a debug behind
(0007386)
greg (administrator)
2016-04-16 15:30

decode,stripslashes and hack to increment multiple answer question on QTI import
(0007455)
greg (administrator)
2016-06-30 17:43

Close for 2.2.2

- Related Changesets
ATutor: master a08053f5
Timestamp: 2016-04-16 15:27:52
Author: greg
Details ] Diff ]
5676 decode,stripslashes and hack to increment multiple answer question on QTI import
mod - mods/_core/imsqti/classes/QTIImport.class.php Diff ] File ]
ATutor: master f509461d
Timestamp: 2016-04-16 15:29:38
Author: greg
Details ] Diff ]
5676 decode,stripslashes and hack to increment multiple answer question on QTI import, and removed debug
mod - mods/_core/imsqti/classes/QTIImport.class.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2016-04-09 16:06 greg New Issue
2016-04-16 15:28 greg Note Added: 0007385
2016-04-16 15:30 greg SVN Revision# => a08053f..f509461
2016-04-16 15:30 greg Note Added: 0007386
2016-04-16 15:30 greg Status new => resolved
2016-04-16 15:30 greg Fixed in Version => 2.2.2
2016-04-16 15:30 greg Resolution open => fixed
2016-04-16 15:30 greg Assigned To => greg
2016-04-16 16:10 greg Changeset attached => ATutor master f509461d
2016-04-16 16:11 greg Changeset attached => ATutor master a08053f5
2016-06-30 17:43 greg Note Added: 0007455
2016-06-30 17:43 greg Status resolved => closed


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker