diff --git a/app/Config/Schema/schema.php b/app/Config/Schema/schema.php index a37f1f6..f0133d3 100644 --- a/app/Config/Schema/schema.php +++ b/app/Config/Schema/schema.php @@ -228,19 +228,27 @@ public function after($event = array()) { array( array( 'id' => QuestionFormat::TRUE_FALSE, - 'name' => 'T/F' + 'name' => 'T/F', + 'question_info_diverge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/dive-t-f.htm', + 'question_info_converge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/conv-t-f.htm' ), array( 'id' => QuestionFormat::MULTIPLE_CHOICE, - 'name' => 'mc' + 'name' => 'mc', + 'question_info_diverge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/dive-mcq.htm', + 'question_info_converge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/conv-mcq.htm' ), array( 'id' => QuestionFormat::MULTIPLE_RESPONSE, - 'name' => 'mr' + 'name' => 'mr', + 'question_info_diverge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/dive-mrq.htm', + 'question_info_converge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/conv-mrq.htm' ), array( 'id' => QuestionFormat::OPEN_ANSWER, - 'name' => 'open' + 'name' => 'open', + 'question_info_diverge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/pro-con-general.htm', + 'question_info_converge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/pro-con-general.htm' ) ) ); @@ -268,14 +276,15 @@ public function after($event = array()) { } public $answer_options = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), - 'item_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'index'), - 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'item_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true), 'value' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'is_correct' => array('type' => 'boolean', 'null' => false, 'default' => null), - 'given_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), - 'given_answer_irc' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,3'), - 'given_answer_percentage' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,1'), + 'given_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'given_answer_irc' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), + 'given_answer_percentage' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,1', 'unsigned' => true), + 'category_given_answer_irc' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'item_id' => array('column' => 'item_id', 'unique' => 0) @@ -284,7 +293,7 @@ public function after($event = array()) { ); public $development_phases = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'name_nld' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'name_eng' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( @@ -293,8 +302,21 @@ public function after($event = array()) { 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); + public $categories = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'exam_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'cronbachs_alpha' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), + 'max_answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + 'exam_id' => array('column' => 'exam_id', 'unique' => 0) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + public $exam_formats = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1) @@ -303,7 +325,7 @@ public function after($event = array()) { ); public $exam_states = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), 'name_eng' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'name_nld' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( @@ -313,18 +335,17 @@ public function after($event = array()) { ); public $exams = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), - 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'key' => 'index'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'exam_state_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'key' => 'index'), - 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'), - 'exam_format_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'key' => 'index'), + 'exam_state_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'index'), + 'exam_format_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), 'data_filename' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'mapping_filename' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), - 'max_answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), - 'cronbachs_alpha' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,3'), - 'report_filename' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'max_answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'cronbachs_alpha' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), 'uploaded' => array('type' => 'datetime', 'null' => true, 'default' => null), 'imported' => array('type' => 'datetime', 'null' => true, 'default' => null), 'duplicated' => array('type' => 'datetime', 'null' => true, 'default' => null), @@ -344,12 +365,12 @@ public function after($event = array()) { ); public $given_answers = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), - 'item_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'index'), - 'subject_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'index'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'item_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'subject_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), 'value' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'score' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '10,8', 'unsigned' => false), 'content' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'score' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '10,8'), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'item_id' => array('column' => 'item_id', 'unique' => 0), @@ -359,11 +380,11 @@ public function after($event = array()) { ); public $images = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), - 'question_id' => array('type' => 'integer', 'null' => true, 'default' => null), + 'id' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 36, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'question_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), 'filename' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'extension' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'filesize' => array('type' => 'integer', 'null' => true, 'default' => null), + 'filesize' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), 'file_type' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( @@ -373,9 +394,9 @@ public function after($event = array()) { ); public $instructions = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), - 'development_phase_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'key' => 'index'), - 'question_format_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'key' => 'index'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'development_phase_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'key' => 'index'), + 'question_format_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'key' => 'index'), 'url' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'content' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), @@ -389,31 +410,34 @@ public function after($event = array()) { ); public $items = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), - 'exam_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'index'), - 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10), - 'second_version_order' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'exam_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'category_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true), + 'second_version_order' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), 'value' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), - 'correct_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), - 'correct_answer_percentage' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,1'), - 'correct_answer_irc' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,3'), - 'missing_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), - 'missing_answer_percentage' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,1'), + 'answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'correct_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'correct_answer_percentage' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,1', 'unsigned' => true), + 'correct_answer_irc' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), + 'missing_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'missing_answer_percentage' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,1', 'unsigned' => true), + 'category_correct_answer_irc' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), - 'exam_id' => array('column' => 'exam_id', 'unique' => 0) + 'exam_id' => array('column' => 'exam_id', 'unique' => 0), + 'category_id' => array('column' => 'category_id', 'unique' => 0) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); public $question_answers = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), - 'question_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'question_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'index'), 'name' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'feedback' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'is_correct' => array('type' => 'boolean', 'null' => false, 'default' => null), - 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10), + 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'question_id' => array('column' => 'question_id', 'unique' => 0) @@ -422,8 +446,10 @@ public function after($event = array()) { ); public $question_formats = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'question_info_diverge_url' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'question_info_converge_url' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1) ), @@ -431,11 +457,12 @@ public function after($event = array()) { ); public $questions = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'code' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'question_format_id' => array('type' => 'integer', 'null' => true, 'default' => null), - 'development_phase_id' => array('type' => 'integer', 'null' => true, 'default' => null), + 'question_format_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'development_phase_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'taxonomy_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), 'stimulus' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'comment' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'answer' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), @@ -443,7 +470,7 @@ public function after($event = array()) { 'feedback_when_correct' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'updated' => array('type' => 'datetime', 'null' => true, 'default' => null), - 'user_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'key' => 'index'), + 'user_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'key' => 'index'), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'user_id' => array('column' => 'user_id', 'unique' => 0) @@ -452,9 +479,9 @@ public function after($event = array()) { ); public $questions_tags = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), - 'question_id' => array('type' => 'integer', 'null' => false, 'default' => null), - 'tag_id' => array('type' => 'integer', 'null' => false, 'default' => null), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'question_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'tag_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( @@ -464,7 +491,7 @@ public function after($event = array()) { ); public $queued_tasks = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), 'job_type' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'data' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'group' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), @@ -472,7 +499,7 @@ public function after($event = array()) { 'not_before' => array('type' => 'datetime', 'null' => true, 'default' => null), 'fetched' => array('type' => 'datetime', 'null' => true, 'default' => null), 'completed' => array('type' => 'datetime', 'null' => true, 'default' => null), - 'failed' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10), + 'failed' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true), 'failure_message' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'worker_key' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'created' => array('type' => 'datetime', 'null' => false, 'default' => null), @@ -483,7 +510,7 @@ public function after($event = array()) { ); public $roles = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1) @@ -492,8 +519,8 @@ public function after($event = array()) { ); public $subjects = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), - 'exam_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'index'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'exam_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), 'value' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'is_second_version' => array('type' => 'boolean', 'null' => false, 'default' => null), 'indexes' => array( @@ -504,9 +531,9 @@ public function after($event = array()) { ); public $tags = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'index'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( @@ -517,7 +544,7 @@ public function after($event = array()) { ); public $tips = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'content' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( @@ -527,11 +554,11 @@ public function after($event = array()) { ); public $users = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'username' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'password' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'role_id' => array('type' => 'integer', 'null' => true, 'default' => null), + 'role_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), 'surfconext_identifier' => array('type' => 'string', 'null' => true, 'default' => null, 'key' => 'unique', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), diff --git a/app/Model/AppModel.php b/app/Model/AppModel.php index 9178f1d..84f8975 100644 --- a/app/Model/AppModel.php +++ b/app/Model/AppModel.php @@ -113,4 +113,82 @@ public function removeFieldFromSchema($fieldname) { unset($this->_schema[$fieldname]); } +/** + * Save analysis to an ezam or a category + * + * @param int $id A category/exam id + * @param array $analysis An array with analysis data + * @return bool True on success, or false on failure. + * @throws NotImplementedException + */ + public function saveAnalysis($id, $analysis) { + if (!in_array($this->alias, array('Category', 'Exam'))) { + throw new NotImplementedException(); + } + + $cronbachsAlpha = $analysis[0]; + $maxAnswerOptionCount = $analysis[1]; + $correctAnswerCount = $analysis[2]; + $correctAnswerPercentage = $analysis[3]; + $correctAnswerIrc = $analysis[4]; + $givenAnswerOptionCount = $analysis[5]; + $givenAnswerOptionPercentage = $analysis[6]; + $givenAnswerOptionIrc = $analysis[7]; + + $conditions = array(sprintf('%s.id', $this->alias) => $id); + $contain = array('Item' => array('AnswerOption')); + $object = $this->find('first', compact('conditions', 'contain')); + + if ($this->alias === 'Category') { + $data = array( + 'Category' => array( + 'id' => $id, + 'cronbachs_alpha' => $cronbachsAlpha, + ) + ); + } elseif ($this->alias === 'Exam') { + $data = array( + 'Exam' => array( + 'id' => $id, + 'exam_state_id' => ExamState::ANALYSED, + 'cronbachs_alpha' => $cronbachsAlpha, + 'max_answer_option_count' => $maxAnswerOptionCount, + 'analysed' => date('Y-m-d H:i:s') + ) + ); + } + + foreach ($object['Item'] as $i => $item) { + $data['Item'][$i] = array('id' => $item['id']); + if ($this->alias === 'Category') { + $data['Item'][$i]['category_correct_answer_irc'] = $correctAnswerIrc[$i]; + } elseif ($this->alias === 'Exam') { + $data['Item'][$i]['correct_answer_count'] = $correctAnswerCount[$i]; + $data['Item'][$i]['correct_answer_percentage'] = $correctAnswerPercentage[$i]; + $data['Item'][$i]['correct_answer_irc'] = $correctAnswerIrc[$i]; + $data['Item'][$i]['missing_answer_count'] = $givenAnswerOptionCount[$i * ($maxAnswerOptionCount + 1)]; + $data['Item'][$i]['missing_answer_percentage'] = $givenAnswerOptionPercentage[$i * ($maxAnswerOptionCount + 1)]; + } + + for ($j = 0; !empty($item['answer_option_count']) && $j < $item['answer_option_count']; $j++) { + if (empty($item['AnswerOption'][$j]['id'])) { + $data['Item'][$i]['AnswerOption'][$j]['order'] = ($j + 1); + } else { + $data['Item'][$i]['AnswerOption'][$j]['id'] = $item['AnswerOption'][$j]['id']; + } + + if ($this->alias === 'Category') { + $data['Item'][$i]['AnswerOption'][$j]['category_given_answer_irc'] = (is_nan($givenAnswerOptionIrc[$i * ($maxAnswerOptionCount + 1) + $j + 1])?null:$givenAnswerOptionIrc[$i * ($maxAnswerOptionCount + 1) + $j + 1]); + } elseif ($this->alias === 'Exam') { + $data['Item'][$i]['AnswerOption'][$j]['given_answer_count'] = $givenAnswerOptionCount[$i * ($maxAnswerOptionCount + 1) + $j + 1]; + $data['Item'][$i]['AnswerOption'][$j]['given_answer_percentage'] = $givenAnswerOptionPercentage[$i * ($maxAnswerOptionCount + 1) + $j + 1]; + $data['Item'][$i]['AnswerOption'][$j]['given_answer_irc'] = (is_nan($givenAnswerOptionIrc[$i * ($maxAnswerOptionCount + 1) + $j + 1])?null:$givenAnswerOptionIrc[$i * ($maxAnswerOptionCount + 1) + $j + 1]); + } else { + } + } + } + $this->id = $id; + return $this->saveAll($data, array('deep' => true)); + } + } diff --git a/app/Model/Category.php b/app/Model/Category.php new file mode 100644 index 0000000..4faaebf --- /dev/null +++ b/app/Model/Category.php @@ -0,0 +1,157 @@ + array( + 'notBlank' => array( + 'rule' => 'notBlank', + 'message' => 'This field cannot be left blank' + ), + 'required' => array( + 'rule' => 'notBlank', + 'required' => true, + 'on' => 'create' + ) + ), + 'name' => array( + 'notBlank' => array( + 'rule' => 'notBlank', + 'message' => 'This field cannot be left blank' + ), + 'maxLength' => array( + 'rule' => array('maxLength', 255), + 'allowEmpty' => false, + 'message' => 'Can not be longer than %d characters.' + ), + 'isUnique' => array( + 'rule' => array('isUnique', array('exam_id', 'name'), false), + 'message' => 'This name has already been taken for this exam.' + ), + 'required' => array( + 'rule' => 'notBlank', + 'required' => true, + 'on' => 'create' + ) + ) + ); + +/** + * belongsTo associations + * + * @var array + */ + public $belongsTo = array( + 'Exam' => array( + 'className' => 'Exam', + 'foreignKey' => 'exam_id' + ) + ); + +/** + * hasMany associations + * + * @var array + */ + public $hasMany = array( + 'Item' => array( + 'className' => 'Item', + 'foreignKey' => 'category_id', + 'dependent' => false + ) + ); + +/** + * analyse + * + * @param int $id A category id + * @param int $examId An exam id + * @return bool + */ + public function analyse($id, $examId) { + $result = $this->Exam->doAnalyse($examId, $id); + + if ($result) { + $result = $this->saveAnalysis($id, $result); + } + return $result; + } + +/** + * Creates categories for given category names and exam and returns ids + * + * @param int $examId An exam id + * @param array $names An array with names of categories + * @return bool|array An array with category ids in the same order as corresponding given names, false on failure + */ + public function createCategories($examId, $names) { + $categoryIds = array(); + if (!empty($names)) { + $uniqueNames = array_values($names); + $uniqueNames = array_unique($uniqueNames); + + $data = array(); + foreach ($uniqueNames as $name) { + $data[] = array( + 'exam_id' => $examId, + 'name' => $name + ); + } + $this->create(); + if ($this->saveAll($data)) { + $conditions = array('Category.exam_id' => $examId); + $categories = $this->find('list', compact('conditions')); + + foreach ($names as $i => $name) { + foreach ($categories as $id => $category) { + if ($name === $category) { + $categoryIds[$i] = $id; + break; + } + } + } + } else { + $categoryIds = false; + } + } + return $categoryIds; + } + +/** + * Duplicate all categories of given exam ids + * + * @param array $examIds A hash with original exam ids as key and corresponding duplicated exam ids as value + * @return array|bool A hash with original category ids as key and corresponding duplicated category ids as value, false on failure + */ + public function duplicate($examIds) { + $mapping = array(); + + $conditions = array('Category.exam_id' => array_keys($examIds)); + $categories = $this->find('all', compact('conditions')); + + foreach ($categories as $category) { + $oldId = $category['Category']['id']; + unset($category['Category']['id']); + $category['Category']['exam_id'] = $examIds[$category['Category']['exam_id']]; + + $this->create(); + if (!$this->save($category)) { + return false; + } + $mapping[$oldId] = $this->getInsertID(); + } + return $mapping; + } + +} diff --git a/app/Model/Exam.php b/app/Model/Exam.php index 5596132..11f0964 100644 --- a/app/Model/Exam.php +++ b/app/Model/Exam.php @@ -12,13 +12,14 @@ /** * Exam Model * - * @property User $User - * @property Item $Item - * @property Subject $Subject + * @property Category $Category + * @property Exam $Child * @property ExamFormat $ExamFormat * @property ExamState $ExamState + * @property Item $Item * @property Exam $Parent - * @property Exam $Child + * @property Subject $Subject + * @property User $User */ class Exam extends AppModel { @@ -60,8 +61,7 @@ class Exam extends AppModel { 'notBlank' => array( 'rule' => 'notBlank', 'message' => 'This field cannot be left blank', - 'required' => 'create', - 'last' => true + 'required' => 'create' ), 'inList' => array( 'rule' => array('inList', array(ExamFormat::TELEFORM, ExamFormat::BLACKBOARD, ExamFormat::QMP), false), @@ -74,13 +74,11 @@ class Exam extends AppModel { 'extension', array('csv', 'txt') ), 'required' => 'create', - 'message' => 'Please supply a csv or txt file.', - 'last' => true + 'message' => 'Please supply a csv or txt file.' ), 'fileSize' => array( 'rule' => array('filesize', '<=', '8MB'), - 'message' => 'File must be less than 8 MB', - 'last' => true + 'message' => 'File must be less than 8 MB' ), 'uploadError' => array( 'rule' => 'uploadError', @@ -93,14 +91,12 @@ class Exam extends AppModel { 'extension', array('csv'), ), 'allowEmpty' => true, - 'message' => 'Please supply a csv file.', - 'last' => true + 'message' => 'Please supply a csv file.' ), 'fileSize' => array( 'rule' => array('filesize', '<=', '1MB'), 'allowEmpty' => true, - 'message' => 'File must be less than 1 MB', - 'last' => true + 'message' => 'File must be less than 1 MB' ), 'uploadError' => array( 'rule' => 'uploadError', @@ -111,8 +107,7 @@ class Exam extends AppModel { 'naturalNumber' => array( 'rule' => 'naturalNumber', 'required' => 'create', - 'message' => 'Please supply the default number of answer options.', - 'last' => true + 'message' => 'Please supply the default number of answer options.' ), 'comparison' => array( 'rule' => array('comparison', '<=', 8), @@ -171,6 +166,11 @@ class Exam extends AppModel { * @var array */ public $hasMany = array( + 'Category' => array( + 'className' => 'Category', + 'foreignKey' => 'exam_id', + 'dependent' => true + ), 'Child' => array( 'className' => 'Exam', 'foreignKey' => 'parent_id', @@ -365,29 +365,62 @@ public function analyse($id) { $conditions = array('Exam.id' => $id); $exam = $this->find('first', compact('conditions')); if (!empty($exam)) { - return $this->_analyse($exam); + return $this->_analyse($id); } return false; } /** - * _analyse + * Analyse an exam * - * @param array $exam Exam data + * @param int $id An exam id * @return bool */ - protected function _analyse($exam) { - $this->id = $exam['Exam']['id']; + protected function _analyse($id) { + $this->id = $id; $this->saveField('exam_state_id', ExamState::ANALYSING); - $conditions = array('Exam.id' => $exam['Exam']['id']); + $result = $this->doAnalyse($id); + + if ($result) { + $result = $this->saveAnalysis($id, $result); + } + + if ($result) { + $this->scheduleReport($id); + } else { + $this->id = $id; + $this->saveField('exam_state_id', ExamState::ANALYSE_FAILED); + } + + return $result; + } + +/** + * Analyse an exam, optionally filter items by a category + * + * @param int $id An exam id + * @param int[optional] $categoryId A category id + * @return array + */ + public function doAnalyse($id, $categoryId = null) { + $conditions = array('Exam.id' => $id); $contain = array( - 'Item' => 'AnswerOption', - 'Subject' => 'GivenAnswer' + 'Item' => array('AnswerOption'), + 'Subject' => array('GivenAnswer') ); + if ($categoryId !== null) { + $itemIds = $this->Item->getIds($id, $categoryId); + + $contain['Item']['conditions'] = array('Item.category_id' => $categoryId); + $contain['Subject']['GivenAnswer']['conditions'] = array('GivenAnswer.item_id' => $itemIds); + } $exam = $this->find('first', compact('conditions', 'contain')); $fields = array('MAX(Item.answer_option_count) as answer_option_count'); $conditions = array('Item.exam_id' => $exam['Exam']['id']); + if ($categoryId !== null) { + $conditions['Item.category_id'] = $categoryId; + } $maxAnswerOptionCount = $this->Item->find('first', compact('fields', 'conditions')); $maxAnswerOptionCount = $maxAnswerOptionCount[0]['answer_option_count']; @@ -407,61 +440,7 @@ protected function _analyse($exam) { } } - $result = $this->_executeAnalysis($questionCount, $studentCount, $maxAnswerOptionCount, $exam, $givenAnswers, $answerOptionCount); - - if ($result) { - $cronbachsAlpha = $result[0]; - $maxAnswerOptionCount = $result[1]; - $correctAnswerCount = $result[2]; - $correctAnswerPercentage = $result[3]; - $correctAnswerIrc = $result[4]; - $givenAnswerOptionCount = $result[5]; - $givenAnswerOptionPercentage = $result[6]; - $givenAnswerOptionIrc = $result[7]; - - $data = array( - 'Exam' => array( - 'id' => $exam['Exam']['id'], - 'exam_state_id' => ExamState::ANALYSED, - 'cronbachs_alpha' => $cronbachsAlpha, - 'max_answer_option_count' => $maxAnswerOptionCount, - 'analysed' => date('Y-m-d H:i:s') - ) - ); - - foreach ($exam['Item'] as $i => $item) { - $data['Item'][$i] = array( - 'id' => $item['id'], - 'correct_answer_count' => $correctAnswerCount[$i], - 'correct_answer_percentage' => $correctAnswerPercentage[$i], - 'correct_answer_irc' => $correctAnswerIrc[$i] - ); - $data['Item'][$i]['missing_answer_count'] = $givenAnswerOptionCount[$i * ($maxAnswerOptionCount + 1)]; - $data['Item'][$i]['missing_answer_percentage'] = $givenAnswerOptionPercentage[$i * ($maxAnswerOptionCount + 1)]; - - for ($j = 0; !empty($item['answer_option_count']) && $j < $item['answer_option_count']; $j++) { - if (empty($item['AnswerOption'][$j]['id'])) { - $data['Item'][$i]['AnswerOption'][$j]['order'] = ($j + 1); - } else { - $data['Item'][$i]['AnswerOption'][$j]['id'] = $item['AnswerOption'][$j]['id']; - } - $data['Item'][$i]['AnswerOption'][$j]['given_answer_count'] = $givenAnswerOptionCount[$i * ($maxAnswerOptionCount + 1) + $j + 1]; - $data['Item'][$i]['AnswerOption'][$j]['given_answer_percentage'] = $givenAnswerOptionPercentage[$i * ($maxAnswerOptionCount + 1) + $j + 1]; - $data['Item'][$i]['AnswerOption'][$j]['given_answer_irc'] = (is_nan($givenAnswerOptionIrc[$i * ($maxAnswerOptionCount + 1) + $j + 1])?null:$givenAnswerOptionIrc[$i * ($maxAnswerOptionCount + 1) + $j + 1]); - } - } - $this->id = $exam['Exam']['id']; - $result = $this->saveAll($data, array('deep' => true)); - } - - if ($result) { - $this->scheduleReport($exam['Exam']['id']); - } else { - $this->id = $exam['Exam']['id']; - $this->saveField('exam_state_id', ExamState::ANALYSE_FAILED); - } - - return $result; + return $this->_executeAnalysis($questionCount, $studentCount, $maxAnswerOptionCount, $exam, $givenAnswers, $answerOptionCount); } /** @@ -1075,40 +1054,9 @@ public function importTeleform($exam) { $versionMappingFilename = Exam::UPLOADS . $exam['Exam']['mapping_filename']; } - if (!empty($versionMappingFilename)) { - ini_set('auto_detect_line_endings', true); - if (($handle = fopen($versionMappingFilename, "r")) !== false) { - $version1Index = false; - $version2Index = false; - $answerOptionCountIndex = false; - for ($i = 0; !feof($handle); $i++) { - $line = fgets($handle); - $line = $this->_decodeLine($line, $i == 0); - - if ($i == 0) { - $header = str_getcsv($line, ';', '"', '"'); + list($versionMapping, $answerOptionCount, $categories) = $this->_extractTeleformMappingfile($versionMappingFilename); - $version1Index = $this->_getIndexOfVersionFromTeleformHeader($header, 1); - $version2Index = $this->_getIndexOfVersionFromTeleformHeader($header, 2); - $answerOptionCountIndex = array_search('Answer Option Count', $header); - } else { - $values = str_getcsv($line, ';', '"', '"'); - if (count($values) <= 1) { - continue; - } - if ($version1Index !== false && $version2Index !== false) { - $versionMapping[2][$values[$version1Index]] = intval($values[$version2Index]); - } - - if ($version1Index !== false && $answerOptionCountIndex !== false) { - $answerOptionCount[$values[$version1Index]] = intval($values[$answerOptionCountIndex]); - } - } - } - - fclose($handle); - } - } + $categoryIds = $this->Category->createCategories($exam['Exam']['id'], $categories); $result = true; ini_set('auto_detect_line_endings', true); @@ -1136,6 +1084,7 @@ public function importTeleform($exam) { $item = array( 'exam_id' => $exam['Exam']['id'], + 'category_id' => Hash::get($categoryIds, $j - 1), 'order' => $j - 1, 'second_version_order' => $secondVersionOrder, 'value' => $j - 1 @@ -1381,7 +1330,14 @@ protected function _duplicate($postData) { $examId = $this->id; if ($success) { - $itemMapping = $this->Item->duplicate(array($parentId => $examId), $filteredItemIds); + $categoryMapping = $this->Category->duplicate(array($parentId => $examId)); + if ($categoryMapping === false) { + $success = false; + } + } + + if ($success) { + $itemMapping = $this->Item->duplicate(array($parentId => $examId), $categoryMapping, $filteredItemIds); if ($itemMapping === false) { $success = false; } @@ -1553,4 +1509,59 @@ protected function _executeAnalysis($questionCount, $studentCount, $maxAnswerOpt return Rserve::execute($script); } +/** + * Extract version mappings, answer option counts and categories from Teleform mapping file + * + * @param string $filename Filename of a Teleform mapping file + * @return array List of verion mappings, answer option counts and categories + */ + protected function _extractTeleformMappingfile($filename) { + $versionMappings = array(); + $answerOptionCounts = array(); + $categories = array(); + + if (!empty($filename) && file_exists($filename)) { + ini_set('auto_detect_line_endings', true); + if (($handle = fopen($filename, "r")) !== false) { + $version1Index = false; + $version2Index = false; + $answerOptionCountIndex = false; + $categoryIndex = false; + for ($i = 0; !feof($handle); $i++) { + $line = fgets($handle); + $line = $this->_decodeLine($line, $i == 0); + + if ($i == 0) { + $header = str_getcsv($line, ';', '"', '"'); + + $version1Index = $this->_getIndexOfVersionFromTeleformHeader($header, 1); + $version2Index = $this->_getIndexOfVersionFromTeleformHeader($header, 2); + $answerOptionCountIndex = array_search('Answer Option Count', $header); + $categoryIndex = array_search('Category', $header); + } else { + $values = str_getcsv($line, ';', '"', '"'); + if (count($values) <= 1) { + continue; + } + if ($version1Index !== false && $version2Index !== false) { + $versionMappings[2][$values[$version1Index]] = intval($values[$version2Index]); + } + + if ($version1Index !== false && $answerOptionCountIndex !== false) { + $answerOptionCounts[$values[$version1Index]] = intval($values[$answerOptionCountIndex]); + } + + if ($version1Index !== false && $categoryIndex !== false) { + $categories[$values[$version1Index]] = $values[$categoryIndex]; + } + } + } + + fclose($handle); + } + } + + return array($versionMappings, $answerOptionCounts, $categories); + } + } diff --git a/app/Model/Item.php b/app/Model/Item.php index 909b295..f8a5f79 100644 --- a/app/Model/Item.php +++ b/app/Model/Item.php @@ -5,8 +5,9 @@ /** * Item Model * - * @property Exam $Exam * @property AnswerOption $AnswerOption + * @property Category $Category + * @property Exam $Exam */ class Item extends AppModel { @@ -23,6 +24,10 @@ class Item extends AppModel { * @var array */ public $belongsTo = array( + 'Category' => array( + 'className' => 'Category', + 'foreignKey' => 'exam_id' + ), 'Exam' => array( 'className' => 'Exam', 'foreignKey' => 'exam_id' @@ -210,14 +215,32 @@ public function stevie($item, $answerOptionCount = null) { return $item; } +/** + * Get items ids of an exam and optionally filter by a category + * + * @param int $examId An exam id + * @param int[optional] $categoryId A category id + * @return array An array with items ids + */ + public function getIds($examId, $categoryId = null) { + $fields = array('Item.id', 'Item.id'); + $conditions = array('Item.exam_id' => $examId); + if ($categoryId !== null) { + $conditions[] = array('Item.category_id' => $categoryId); + } + $data = $this->find('list', compact('fields', 'conditions')); + return array_values($data); + } + /** * Duplicate all or optionally only filtered items of given exam ids * * @param array $examIds A hash with original exam ids as key and corresponding duplicated exam ids as value + * @param array $categoryIds A hash with original category ids as key and corresponding duplicated category ids as value * @param array[optional] $filteredIds A list of item ids to filter * @return array|bool A hash with original item ids as key and corresponding duplicated item ids as value, false on failure */ - public function duplicate($examIds, $filteredIds = null) { + public function duplicate($examIds, $categoryIds, $filteredIds = null) { $mapping = array(); $conditions = array('Item.exam_id' => array_keys($examIds)); @@ -230,6 +253,9 @@ public function duplicate($examIds, $filteredIds = null) { $oldId = $item['Item']['id']; unset($item['Item']['id']); $item['Item']['exam_id'] = $examIds[$item['Item']['exam_id']]; + if ($item['Item']['category_id'] !== null) { + $item['Item']['category_id'] = $categoryIds[$item['Item']['category_id']]; + } $this->create(); if (!$this->save($item)) { diff --git a/app/Model/QuestionFormat.php b/app/Model/QuestionFormat.php index 4ac6e87..93cf56f 100644 --- a/app/Model/QuestionFormat.php +++ b/app/Model/QuestionFormat.php @@ -25,7 +25,6 @@ class QuestionFormat extends AppModel { 'name' => array( 'notBlank' => array( 'rule' => 'notBlank', - 'last' => true, 'message' => 'This field cannot be left blank' ), 'required' => array( diff --git a/app/Model/Tag.php b/app/Model/Tag.php index d95ff41..b8f5741 100644 --- a/app/Model/Tag.php +++ b/app/Model/Tag.php @@ -25,7 +25,6 @@ class Tag extends AppModel { 'name' => array( 'notBlank' => array( 'rule' => 'notBlank', - 'last' => true, 'message' => 'This field cannot be left blank' ), 'required' => array( diff --git a/app/Model/User.php b/app/Model/User.php index 69d0644..db112ba 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -18,12 +18,10 @@ class User extends AppModel { 'email' => array( 'rule' => 'email', 'allowEmpty' => false, - 'last' => true, 'message' => 'Please supply a valid email address.' ), 'isUnique' => array( 'rule' => 'isUnique', - 'last' => true, 'message' => 'This username has already been taken.' ), 'required' => array( @@ -35,7 +33,6 @@ class User extends AppModel { 'name' => array( 'notBlank' => array( 'rule' => 'notBlank', - 'last' => true, 'message' => 'This field cannot be left blank' ), 'required' => array( @@ -58,7 +55,6 @@ class User extends AppModel { 'minLength' => array( 'rule' => array('minLength', 6), 'allowEmpty' => false, - 'last' => true, 'message' => 'Passwords must be at least 8 characters long.' ), 'required' => array( @@ -69,7 +65,6 @@ class User extends AppModel { 'role_id' => array( 'notBlank' => array( 'rule' => 'notBlank', - 'last' => true, 'message' => 'This field cannot be left blank' ), 'required' => array( diff --git a/app/Test/Case/Controller/ExamsControllerTest.php b/app/Test/Case/Controller/ExamsControllerTest.php index a241000..23ecbdb 100644 --- a/app/Test/Case/Controller/ExamsControllerTest.php +++ b/app/Test/Case/Controller/ExamsControllerTest.php @@ -20,7 +20,7 @@ class ExamsControllerTest extends ControllerTestCase { * @var array */ public $fixtures = array( - 'app.exam', 'app.exam_format', 'app.exam_state', 'app.item', 'app.user' + 'app.answer_option', 'app.exam', 'app.exam_format', 'app.exam_state', 'app.item', 'app.user' ); /** @@ -76,7 +76,7 @@ public function testIndexGet() { * @return void */ public function testViewGet() { - $this->loadFixtures('Item', 'User'); + $this->loadFixtures('AnswerOption', 'Item', 'User'); $this->testAction('/exams/view/1', array('method' => 'get', 'return' => 'contents')); $this->assertInternalType('array', $this->vars['exam']); diff --git a/app/Test/Case/Model/AnswerOptionTest.php b/app/Test/Case/Model/AnswerOptionTest.php index 90ba1cc..fc0dfed 100644 --- a/app/Test/Case/Model/AnswerOptionTest.php +++ b/app/Test/Case/Model/AnswerOptionTest.php @@ -7,6 +7,13 @@ */ class AnswerOptionTest extends CakeTestCase { +/** + * Auto fixtures. + * + * @var bool + */ + public $autoFixtures = false; + /** * Fixtures * @@ -42,6 +49,13 @@ public function tearDown() { * @return void */ public function testDuplicate() { + $this->loadFixtures('AnswerOption'); + + $expected = array(); + $examIds = array(); + $result = $this->AnswerOption->duplicate($examIds); + $this->assertSame($expected, $result); + $itemIds = array(21773 => 100000); $conditions = array('AnswerOption.item_id' => array_keys($itemIds)); diff --git a/app/Test/Case/Model/CategoryTest.php b/app/Test/Case/Model/CategoryTest.php new file mode 100644 index 0000000..4ae1725 --- /dev/null +++ b/app/Test/Case/Model/CategoryTest.php @@ -0,0 +1,113 @@ +Category = ClassRegistry::init('Category'); + } + +/** + * tearDown method + * + * @return void + */ + public function tearDown() { + unset($this->Category); + + parent::tearDown(); + } + +/** + * testCreateCategories method + * + * @return void + */ + public function testCreateCategories() { + $this->loadFixtures('Category'); + + $expected = array(); + $examId = 2; + $names = array(); + $result = $this->Category->createCategories($examId, $names); + $this->assertSame($expected, $result); + + $expected = array(3); + $examId = 2; + $names = array('test'); + $result = $this->Category->createCategories($examId, $names); + $this->assertEquals($expected, $result); + + $expected = array(4, 4); + $examId = 3; + $names = array('test', 'test'); + $result = $this->Category->createCategories($examId, $names); + $this->assertEquals($expected, $result); + } + +/** + * testAnalyse method + * + * @return void + */ + public function testAnalyse() { + $this->loadFixtures('AnswerOption', 'Category', 'Exam', 'GivenAnswer', 'Item', 'Subject'); + + $id = 1; + $examId = 1; + $result = $this->Category->analyse($id, $examId); + $this->assertTrue($result); + } + +/** + * testDuplicate method + * + * @return void + */ + public function testDuplicate() { + $this->loadFixtures('Category'); + + $expected = array(); + $examIds = array(); + $result = $this->Category->duplicate($examIds); + $this->assertSame($expected, $result); + + $expected = array( + 1 => 3, + 2 => 4 + ); + $examIds = array(1 => 987); + $result = $this->Category->duplicate($examIds); + $this->assertEquals($expected, $result); + + $examIds = array(1 => 1); + $result = $this->Category->duplicate($examIds); + $this->assertFalse($result); + } + +} diff --git a/app/Test/Case/Model/ExamTest.php b/app/Test/Case/Model/ExamTest.php index bbd316a..1acf3fd 100644 --- a/app/Test/Case/Model/ExamTest.php +++ b/app/Test/Case/Model/ExamTest.php @@ -45,6 +45,14 @@ public function duplicate($postData) { return parent::_duplicate($postData); } +/** + * Public test double of `parent::_extractTeleformMappingfile`. + * + */ + public function extractTeleformMappingfile($filename) { + return parent::_extractTeleformMappingfile($filename); + } + /** * Public test double of `parent::_decodeLine`. * @@ -73,7 +81,9 @@ class ExamTest extends CakeTestCase { * * @var array */ - public $fixtures = array('app.answer_option', 'app.exam', 'app.given_answer', 'app.item', 'app.subject'); + public $fixtures = array( + 'app.answer_option', 'app.category', 'app.exam', 'app.given_answer', 'app.item', 'app.queued_task', 'app.subject' + ); /** * setUp method @@ -251,7 +261,11 @@ public function testScheduleAnalyse() { * @return void */ public function testAnalyse() { - $this->markTestIncomplete('testAnalyse not implemented.'); + $this->loadFixtures('AnswerOption', 'Exam', 'GivenAnswer', 'Item', 'QueuedTask', 'Subject'); + + $id = 1; + $result = $this->Exam->analyse($id); + $this->assertTrue((bool)$result); } /** @@ -365,7 +379,7 @@ public function testDuplicate() { } protected function _testDuplicateExamWithSubjectsWithNonUniqueIdentifiers() { - $this->loadFixtures('AnswerOption', 'Exam', 'GivenAnswer', 'Item', 'Subject'); + $this->loadFixtures('AnswerOption', 'Category', 'Exam', 'GivenAnswer', 'Item', 'Subject'); $examId = 2; $postData = $this->_createPostDataForDuplicate($examId); @@ -390,7 +404,7 @@ protected function _testDuplicateExamWithSubjectsWithNonUniqueIdentifiers() { } protected function _testDuplicateExamWithMissingGivenAnswers() { - $this->loadFixtures('AnswerOption', 'Exam', 'GivenAnswer', 'Item', 'Subject'); + $this->loadFixtures('AnswerOption', 'Category', 'Exam', 'GivenAnswer', 'Item', 'Subject'); $expected = 748; @@ -427,6 +441,98 @@ protected function _stripIds($data) { return $data; } +/** + * testExtractTeleformMappingfile method + * + * @return void + */ + public function testExtractTeleformMappingfile() { + $files = array( + 'Teleform-mappingfile.csv', + 'Teleform-mappingfile-with-spaces-in-version-column-headers.csv', + 'Teleform-mappingfile-with-upper-and-lower-case-in-version-column-headers.csv' + ); + + $expectedVersionMapping = array( + 2 => array( + 1 => 2, + 2 => 1 + ) + ); + $expectedAnswerOptionCount = array( + 1 => 3, + 2 => 3 + ); + + foreach ($files as $file) { + $filename = APP . DS . 'Test' . DS . 'File' . DS . 'Exam' . DS . $file; + $result = $this->Exam->extractTeleformMappingfile($filename); + $this->assertTrue((bool)$result); + list($versionMapping, $answerOptionCount, $categories) = $result; + $this->assertEquals($expectedVersionMapping, $versionMapping); + $this->assertEquals($expectedAnswerOptionCount, $answerOptionCount); + $this->assertEmpty($categories); + } + } + +/** + * testExtractTeleformMappingfileWithCategory method + * + * @return void + */ + public function testExtractTeleformMappingfileWithCategory() { + $expectedVersionMapping = array( + 2 => array( + 1 => 2, + 2 => 1 + ) + ); + $expectedAnswerOptionCount = array( + 1 => 3, + 2 => 3 + ); + + $expectedCategories = array( + 1 => 'M', + 2 => 'G' + ); + + $filename = APP . DS . 'Test' . DS . 'File' . DS . 'Exam' . DS . 'Teleform-mappingfile-with-category.csv'; + $result = $this->Exam->extractTeleformMappingfile($filename); + $this->assertTrue((bool)$result); + list($versionMapping, $answerOptionCount, $categories) = $result; + $this->assertEquals($expectedVersionMapping, $versionMapping); + $this->assertEquals($expectedAnswerOptionCount, $answerOptionCount); + $this->assertEquals($expectedCategories, $categories); + } + +/** + * testExtractTeleformMappingfileWithCategoryWithoutAnswerOptionCount method + * + * @return void + */ + public function testExtractTeleformMappingfileWithCategoryWithoutAnswerOptionCount() { + $expectedVersionMapping = array( + 2 => array( + 1 => 2, + 2 => 1 + ) + ); + + $expectedCategories = array( + 1 => 'M', + 2 => 'G' + ); + + $filename = APP . DS . 'Test' . DS . 'File' . DS . 'Exam' . DS . 'Teleform-mappingfile-with-category-without-answer-option-count.csv'; + $result = $this->Exam->extractTeleformMappingfile($filename); + $this->assertTrue((bool)$result); + list($versionMapping, $answerOptionCount, $categories) = $result; + $this->assertEquals($expectedVersionMapping, $versionMapping); + $this->assertEmpty($answerOptionCount); + $this->assertEquals($expectedCategories, $categories); + } + /** * Tests `Exam::_decodeLine`. * diff --git a/app/Test/Case/Model/ItemTest.php b/app/Test/Case/Model/ItemTest.php index 817bf38..0d95119 100644 --- a/app/Test/Case/Model/ItemTest.php +++ b/app/Test/Case/Model/ItemTest.php @@ -19,7 +19,7 @@ class TestItem extends Item { * * @var mixed False or table name */ - public $useTable = 'Items'; + public $useTable = 'items'; /** * Public test double of `parent::_getMostGivenIncorrectAnswerOption`. @@ -48,7 +48,7 @@ class ItemTest extends CakeTestCase { * * @var array */ - public $fixtures = array(); + public $fixtures = array('app.item'); /** * setUp method @@ -57,6 +57,7 @@ class ItemTest extends CakeTestCase { */ public function setUp() { parent::setUp(); + $this->Item = ClassRegistry::init('TestItem'); } @@ -89,13 +90,84 @@ public function testStevie() { $this->markTestIncomplete('testStevie not implemented.'); } +/** + * testGetIds method + * + * @return void + */ + public function testGetIds() { + $this->loadFixtures('Item'); + + $expected = array(); + $examId = 0; + $result = $this->Item->getIds($examId); + $this->assertEquals($expected, $result); + + $expected = array(1); + $examId = 2; + $result = $this->Item->getIds($examId); + $this->assertEquals($expected, $result); + + $expected = array(21773); + $examId = 747; + $result = $this->Item->getIds($examId); + $this->assertEquals($expected, $result); + + $expected = array(1000000, 1000001, 1000002, 1000003); + $examId = 1; + $result = $this->Item->getIds($examId); + $this->assertEquals($expected, $result); + + $expected = array(1000000, 1000001, 1000003); + $examId = 1; + $categoryId = 1; + $result = $this->Item->getIds($examId, $categoryId); + $this->assertEquals($expected, $result); + + $expected = array(1000002); + $examId = 1; + $categoryId = 2; + $result = $this->Item->getIds($examId, $categoryId); + $this->assertEquals($expected, $result); + } + /** * testDuplicate method * * @return void */ public function testDuplicate() { - $this->markTestIncomplete('testDuplicate not implemented.'); + $this->loadFixtures('Item'); + + $expected = array(); + $examIds = array(); + $categoryIds = array(); + $result = $this->Item->duplicate($examIds, $categoryIds); + $this->assertSame($expected, $result); + + $expected = array(1 => 1000004); + $examIds = array(2 => 987); + $categoryIds = array(); + $result = $this->Item->duplicate($examIds, $categoryIds); + $this->assertEquals($expected, $result); + + $expected = array( + 1000000 => 1000005, + 1000001 => 1000006, + 1000002 => 1000007, + 1000003 => 1000008 + ); + $examIds = array(1 => 1001); + $categoryIds = array(1 => 1001, 2 => 1002, 3 => 1003); + $result = $this->Item->duplicate($examIds, $categoryIds); + $this->assertEquals($expected, $result); + + $expected = array(1000001 => 1000009); + $examIds = array(1 => 1001); + $categoryIds = array(1 => 1001, 2 => 1002, 3 => 1003); + $filteredIds = array(1000001); + $result = $this->Item->duplicate($examIds, $categoryIds, $filteredIds); + $this->assertEquals($expected, $result); } /** diff --git a/app/Test/File/Exam/Teleform-mappingfile-with-category-without-answer-option-count.csv b/app/Test/File/Exam/Teleform-mappingfile-with-category-without-answer-option-count.csv new file mode 100644 index 0000000..6d0f505 --- /dev/null +++ b/app/Test/File/Exam/Teleform-mappingfile-with-category-without-answer-option-count.csv @@ -0,0 +1,3 @@ +versie.1;versie.2;Category +1;2;M +2;1;G diff --git a/app/Test/File/Exam/Teleform-mappingfile-with-category.csv b/app/Test/File/Exam/Teleform-mappingfile-with-category.csv new file mode 100644 index 0000000..876ae7b --- /dev/null +++ b/app/Test/File/Exam/Teleform-mappingfile-with-category.csv @@ -0,0 +1,3 @@ +versie.1;versie.2;Answer Option Count;Category +1;2;3;M +2;1;3;G diff --git a/app/Test/File/Exam/Teleform-mappingfile-with-spaces-in-version-column-headers.csv b/app/Test/File/Exam/Teleform-mappingfile-with-spaces-in-version-column-headers.csv new file mode 100644 index 0000000..6b6e600 --- /dev/null +++ b/app/Test/File/Exam/Teleform-mappingfile-with-spaces-in-version-column-headers.csv @@ -0,0 +1,3 @@ +versie 1;versie 2;Answer Option Count +1;2;3 +2;1;3 diff --git a/app/Test/File/Exam/Teleform-mappingfile-with-upper-and-lower-case-in-version-column-headers.csv b/app/Test/File/Exam/Teleform-mappingfile-with-upper-and-lower-case-in-version-column-headers.csv new file mode 100644 index 0000000..0627fd7 --- /dev/null +++ b/app/Test/File/Exam/Teleform-mappingfile-with-upper-and-lower-case-in-version-column-headers.csv @@ -0,0 +1,3 @@ +Versie.1;vErSiE.2;Answer Option Count +1;2;3 +2;1;3 diff --git a/app/Test/File/Exam/Teleform-mappingfile.csv b/app/Test/File/Exam/Teleform-mappingfile.csv new file mode 100644 index 0000000..2007c36 --- /dev/null +++ b/app/Test/File/Exam/Teleform-mappingfile.csv @@ -0,0 +1,3 @@ +versie.1;versie.2;Answer Option Count +1;2;3 +2;1;3 diff --git a/app/Test/Fixture/AnswerOptionFixture.php b/app/Test/Fixture/AnswerOptionFixture.php index 4d0650c..493a045 100644 --- a/app/Test/Fixture/AnswerOptionFixture.php +++ b/app/Test/Fixture/AnswerOptionFixture.php @@ -1,7 +1,6 @@ array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'primary'), - 'item_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'index'), - 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'item_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true), 'value' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'is_correct' => array('type' => 'boolean', 'null' => false, 'default' => null), - 'given_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false), - 'given_answer_irc' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), - 'given_answer_percentage' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,1', 'unsigned' => false), + 'given_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'given_answer_irc' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), + 'given_answer_percentage' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,1', 'unsigned' => true), + 'category_given_answer_irc' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'item_id' => array('column' => 'item_id', 'unique' => 0) @@ -78,6 +78,102 @@ class AnswerOptionFixture extends CakeTestFixture { 'given_answer_irc' => 0.045, 'given_answer_percentage' => 29.9 ), + array( + 'id' => 1000000, + 'item_id' => 1000000, + 'order' => 1, + 'is_correct' => true, + ), + array( + 'id' => 1000001, + 'item_id' => 1000000, + 'order' => 2, + 'is_correct' => false, + ), + array( + 'id' => 1000002, + 'item_id' => 1000000, + 'order' => 3, + 'is_correct' => false, + ), + array( + 'id' => 1000003, + 'item_id' => 1000000, + 'order' => 4, + 'is_correct' => false, + ), + array( + 'id' => 1000004, + 'item_id' => 1000001, + 'order' => 1, + 'is_correct' => true, + ), + array( + 'id' => 1000005, + 'item_id' => 1000001, + 'order' => 2, + 'is_correct' => false, + ), + array( + 'id' => 1000006, + 'item_id' => 1000001, + 'order' => 3, + 'is_correct' => false, + ), + array( + 'id' => 1000007, + 'item_id' => 1000001, + 'order' => 4, + 'is_correct' => false, + ), + array( + 'id' => 1000008, + 'item_id' => 1000002, + 'order' => 1, + 'is_correct' => true, + ), + array( + 'id' => 1000009, + 'item_id' => 1000002, + 'order' => 2, + 'is_correct' => false, + ), + array( + 'id' => 1000010, + 'item_id' => 1000002, + 'order' => 3, + 'is_correct' => false, + ), + array( + 'id' => 1000011, + 'item_id' => 1000002, + 'order' => 4, + 'is_correct' => false, + ), + array( + 'id' => 1000012, + 'item_id' => 1000003, + 'order' => 1, + 'is_correct' => true, + ), + array( + 'id' => 1000013, + 'item_id' => 1000003, + 'order' => 2, + 'is_correct' => false, + ), + array( + 'id' => 1000014, + 'item_id' => 1000003, + 'order' => 3, + 'is_correct' => false, + ), + array( + 'id' => 1000015, + 'item_id' => 1000003, + 'order' => 4, + 'is_correct' => false, + ), ); } diff --git a/app/Test/Fixture/CategoryFixture.php b/app/Test/Fixture/CategoryFixture.php new file mode 100644 index 0000000..3ffba77 --- /dev/null +++ b/app/Test/Fixture/CategoryFixture.php @@ -0,0 +1,47 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'exam_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'cronbachs_alpha' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), + 'max_answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + 'exam_id' => array('column' => 'exam_id', 'unique' => 0) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => 1, + 'exam_id' => 1, + 'name' => 'A', + 'cronbachs_alpha' => null, + 'max_answer_option_count' => null + ), + array( + 'id' => 2, + 'exam_id' => 1, + 'name' => 'B', + 'cronbachs_alpha' => null, + 'max_answer_option_count' => null + ), + ); + +} diff --git a/app/Test/Fixture/DevelopmentPhaseFixture.php b/app/Test/Fixture/DevelopmentPhaseFixture.php new file mode 100644 index 0000000..d8bac61 --- /dev/null +++ b/app/Test/Fixture/DevelopmentPhaseFixture.php @@ -0,0 +1,42 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'name_nld' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'name_eng' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => DevelopmentPhase::DIVERGE, + 'name_nld' => 'Divergeren', + 'name_eng' => 'Diverge' + ), + array( + 'id' => DevelopmentPhase::CONVERGE, + 'name_nld' => 'Convergeren', + 'name_eng' => 'Converge' + ), + ); + +} diff --git a/app/Test/Fixture/ExamFixture.php b/app/Test/Fixture/ExamFixture.php index 40d8a4e..4d59d05 100644 --- a/app/Test/Fixture/ExamFixture.php +++ b/app/Test/Fixture/ExamFixture.php @@ -3,8 +3,7 @@ App::uses('ExamState', 'Model'); /** - * ExamFixture - * + * Exam Fixture */ class ExamFixture extends CakeTestFixture { @@ -14,18 +13,17 @@ class ExamFixture extends CakeTestFixture { * @var array */ public $fields = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'primary'), - 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'index'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'exam_state_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'index'), + 'exam_state_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'index'), - 'exam_format_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'index'), + 'exam_format_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), 'data_filename' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'mapping_filename' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false), - 'max_answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false), - 'cronbachs_alpha' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), - 'report_filename' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'max_answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'cronbachs_alpha' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), 'uploaded' => array('type' => 'datetime', 'null' => true, 'default' => null), 'imported' => array('type' => 'datetime', 'null' => true, 'default' => null), 'duplicated' => array('type' => 'datetime', 'null' => true, 'default' => null), @@ -62,7 +60,6 @@ class ExamFixture extends CakeTestFixture { 'answer_option_count' => 3, 'max_answer_option_count' => null, 'cronbachs_alpha' => null, - 'report_filename' => null, 'uploaded' => '2000-01-01 00:00:00', 'imported' => '2000-01-01 00:01:00', 'duplicated' => null, @@ -93,7 +90,6 @@ class ExamFixture extends CakeTestFixture { 'answer_option_count' => 4, 'max_answer_option_count' => 4, 'cronbachs_alpha' => 0.737, - 'report_filename' => null, 'uploaded' => '2015-04-03 09:41:03', 'imported' => '2015-04-03 09:41:18', 'duplicated' => null, diff --git a/app/Test/Fixture/ExamFormatFixture.php b/app/Test/Fixture/ExamFormatFixture.php index e3c7fa0..2ce01e9 100644 --- a/app/Test/Fixture/ExamFormatFixture.php +++ b/app/Test/Fixture/ExamFormatFixture.php @@ -2,8 +2,7 @@ App::uses('ExamFormat', 'Model'); /** - * ExamFormatFixture - * + * ExamFormat Fixture */ class ExamFormatFixture extends CakeTestFixture { @@ -13,7 +12,7 @@ class ExamFormatFixture extends CakeTestFixture { * @var array */ public $fields = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1) diff --git a/app/Test/Fixture/ExamStateFixture.php b/app/Test/Fixture/ExamStateFixture.php index 133e773..606d413 100644 --- a/app/Test/Fixture/ExamStateFixture.php +++ b/app/Test/Fixture/ExamStateFixture.php @@ -2,8 +2,7 @@ App::uses('ExamState', 'Model'); /** - * ExamStateFixture - * + * ExamState Fixture */ class ExamStateFixture extends CakeTestFixture { @@ -13,7 +12,7 @@ class ExamStateFixture extends CakeTestFixture { * @var array */ public $fields = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), 'name_eng' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'name_nld' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( diff --git a/app/Test/Fixture/GivenAnswerFixture.php b/app/Test/Fixture/GivenAnswerFixture.php index b0decb7..0d2f7d5 100644 --- a/app/Test/Fixture/GivenAnswerFixture.php +++ b/app/Test/Fixture/GivenAnswerFixture.php @@ -1,7 +1,6 @@ array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'primary'), - 'item_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'index'), - 'subject_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'index'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'item_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'subject_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), 'value' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'score' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '10,8', 'unsigned' => false), 'content' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'score' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '10,8', 'unsigned' => false), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'item_id' => array('column' => 'item_id', 'unique' => 0), @@ -48,8 +47,64 @@ class GivenAnswerFixture extends CakeTestFixture { 'item_id' => 21773, 'subject_id' => 100843, 'value' => null, - 'content' => null, - 'score' => 0.00000000 + 'score' => 0.00000000, + 'content' => null + ), + array( + 'id' => 1000000, + 'item_id' => 1000000, + 'subject_id' => 1000000, + 'value' => 3, + 'score' => 0, + ), + array( + 'id' => 1000001, + 'item_id' => 1000001, + 'subject_id' => 1000000, + 'value' => 3, + 'score' => 0, + ), + array( + 'id' => 1000002, + 'item_id' => 1000002, + 'subject_id' => 1000000, + 'value' => 3, + 'score' => 0, + ), + array( + 'id' => 1000003, + 'item_id' => 1000003, + 'subject_id' => 1000000, + 'value' => 3, + 'score' => 0, + ), + array( + 'id' => 1000004, + 'item_id' => 1000000, + 'subject_id' => 1000001, + 'value' => 3, + 'score' => 0, + ), + array( + 'id' => 1000005, + 'item_id' => 1000001, + 'subject_id' => 1000001, + 'value' => 3, + 'score' => 0, + ), + array( + 'id' => 1000006, + 'item_id' => 1000002, + 'subject_id' => 1000001, + 'value' => 3, + 'score' => 0, + ), + array( + 'id' => 1000007, + 'item_id' => 1000003, + 'subject_id' => 1000001, + 'value' => 3, + 'score' => 0, ), ); diff --git a/app/Test/Fixture/ImageFixture.php b/app/Test/Fixture/ImageFixture.php index 1343f31..3851a2e 100644 --- a/app/Test/Fixture/ImageFixture.php +++ b/app/Test/Fixture/ImageFixture.php @@ -1,7 +1,6 @@ array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), - 'question_id' => array('type' => 'integer', 'null' => true, 'default' => null), + 'id' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 36, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'question_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), 'filename' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'extension' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'filesize' => array('type' => 'integer', 'null' => true, 'default' => null), + 'filesize' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), 'file_type' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( diff --git a/app/Test/Fixture/InstructionFixture.php b/app/Test/Fixture/InstructionFixture.php new file mode 100644 index 0000000..fafd3d4 --- /dev/null +++ b/app/Test/Fixture/InstructionFixture.php @@ -0,0 +1,35 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'development_phase_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'key' => 'index'), + 'question_format_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'key' => 'index'), + 'url' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'content' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + 'development_phase_id' => array('column' => 'development_phase_id', 'unique' => 0), + 'question_format_id' => array('column' => 'question_format_id', 'unique' => 0) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array(); + +} diff --git a/app/Test/Fixture/ItemFixture.php b/app/Test/Fixture/ItemFixture.php index 5316586..1bca069 100644 --- a/app/Test/Fixture/ItemFixture.php +++ b/app/Test/Fixture/ItemFixture.php @@ -1,7 +1,6 @@ array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'primary'), - 'exam_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'index'), - 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false), - 'second_version_order' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'exam_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'category_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), + 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true), + 'second_version_order' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), 'value' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false), - 'correct_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false), - 'correct_answer_percentage' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,1', 'unsigned' => false), - 'correct_answer_irc' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), - 'missing_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => false), - 'missing_answer_percentage' => array('type' => 'float', 'null' => true, 'default' => null, 'length' => '4,1', 'unsigned' => false), + 'answer_option_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'correct_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'correct_answer_percentage' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,1', 'unsigned' => true), + 'correct_answer_irc' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), + 'missing_answer_count' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10, 'unsigned' => true), + 'missing_answer_percentage' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,1', 'unsigned' => true), + 'category_correct_answer_irc' => array('type' => 'decimal', 'null' => true, 'default' => null, 'length' => '4,3', 'unsigned' => false), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), - 'exam_id' => array('column' => 'exam_id', 'unique' => 0) + 'exam_id' => array('column' => 'exam_id', 'unique' => 0), + 'category_id' => array('column' => 'category_id', 'unique' => 0) ), 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') ); @@ -38,6 +40,7 @@ class ItemFixture extends CakeTestFixture { array( 'id' => 1, 'exam_id' => 2, + 'category_id' => null, 'order' => 1, 'second_version_order' => null, 'value' => '1B 05 individualisering 002', @@ -51,6 +54,7 @@ class ItemFixture extends CakeTestFixture { array( 'id' => 21773, 'exam_id' => 747, + 'category_id' => null, 'order' => 35, 'second_version_order' => null, 'value' => '35', @@ -61,6 +65,38 @@ class ItemFixture extends CakeTestFixture { 'missing_answer_count' => 1, 'missing_answer_percentage' => 1.1 ), + array( + 'id' => 1000000, + 'exam_id' => 1, + 'category_id' => 1, + 'order' => 1, + 'value' => 'Item 1000000', + 'answer_option_count' => 4, + ), + array( + 'id' => 1000001, + 'exam_id' => 1, + 'category_id' => 1, + 'order' => 2, + 'value' => 'Item 1000001', + 'answer_option_count' => 4, + ), + array( + 'id' => 1000002, + 'exam_id' => 1, + 'category_id' => 2, + 'order' => 3, + 'value' => 'Item 1000002', + 'answer_option_count' => 4, + ), + array( + 'id' => 1000003, + 'exam_id' => 1, + 'category_id' => 1, + 'order' => 4, + 'value' => 'Item 1000003', + 'answer_option_count' => 4, + ), ); } diff --git a/app/Test/Fixture/QuestionAnswerFixture.php b/app/Test/Fixture/QuestionAnswerFixture.php new file mode 100644 index 0000000..da450d3 --- /dev/null +++ b/app/Test/Fixture/QuestionAnswerFixture.php @@ -0,0 +1,33 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'question_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'index'), + 'name' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'feedback' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'is_correct' => array('type' => 'boolean', 'null' => false, 'default' => null), + 'order' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + 'question_id' => array('column' => 'question_id', 'unique' => 0) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array(); + +} diff --git a/app/Test/Fixture/QuestionFixture.php b/app/Test/Fixture/QuestionFixture.php index 01960c0..ca1c361 100644 --- a/app/Test/Fixture/QuestionFixture.php +++ b/app/Test/Fixture/QuestionFixture.php @@ -1,7 +1,6 @@ array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'code' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'question_format_id' => array('type' => 'integer', 'null' => true, 'default' => null), - 'development_phase_id' => array('type' => 'integer', 'null' => true, 'default' => null), + 'question_format_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'development_phase_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), + 'taxonomy_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), 'stimulus' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'comment' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'answer' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), @@ -23,7 +23,7 @@ class QuestionFixture extends CakeTestFixture { 'feedback_when_correct' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'updated' => array('type' => 'datetime', 'null' => true, 'default' => null), - 'user_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'key' => 'index'), + 'user_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false, 'key' => 'index'), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), 'user_id' => array('column' => 'user_id', 'unique' => 0) diff --git a/app/Test/Fixture/QuestionFormatFixture.php b/app/Test/Fixture/QuestionFormatFixture.php index 8fc4b3b..4117463 100644 --- a/app/Test/Fixture/QuestionFormatFixture.php +++ b/app/Test/Fixture/QuestionFormatFixture.php @@ -2,8 +2,7 @@ App::uses('QuestionFormat', 'Model'); /** - * QuestionFormatFixture - * + * QuestionFormat Fixture */ class QuestionFormatFixture extends CakeTestFixture { @@ -13,8 +12,10 @@ class QuestionFormatFixture extends CakeTestFixture { * @var array */ public $fields = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'question_info_diverge_url' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'question_info_converge_url' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1) ), @@ -28,20 +29,28 @@ class QuestionFormatFixture extends CakeTestFixture { */ public $records = array( array( - 'id' => '1', - 'name' => QuestionFormat::TRUE_FALSE + 'id' => QuestionFormat::TRUE_FALSE, + 'name' => 'T/F', + 'question_info_diverge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/dive-t-f.htm', + 'question_info_converge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/conv-t-f.htm' ), array( - 'id' => '2', - 'name' => QuestionFormat::MULTIPLE_CHOICE + 'id' => QuestionFormat::MULTIPLE_CHOICE, + 'name' => 'mc', + 'question_info_diverge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/dive-mcq.htm', + 'question_info_converge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/conv-mcq.htm' ), array( - 'id' => '3', - 'name' => QuestionFormat::MULTIPLE_RESPONSE + 'id' => QuestionFormat::MULTIPLE_RESPONSE, + 'name' => 'mr', + 'question_info_diverge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/dive-mrq.htm', + 'question_info_converge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/conv-mrq.htm' ), array( - 'id' => '4', - 'name' => QuestionFormat::OPEN_ANSWER + 'id' => QuestionFormat::OPEN_ANSWER, + 'name' => 'open', + 'question_info_diverge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/pro-con-general.htm', + 'question_info_converge_url' => 'http://testdevelopment.nl/qdst/qdst-nl/pro-con-q-formats/pro-con-general.htm' ), ); diff --git a/app/Test/Fixture/QuestionsTagFixture.php b/app/Test/Fixture/QuestionsTagFixture.php index b2be574..4706c2f 100644 --- a/app/Test/Fixture/QuestionsTagFixture.php +++ b/app/Test/Fixture/QuestionsTagFixture.php @@ -1,7 +1,6 @@ array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), - 'question_id' => array('type' => 'integer', 'null' => false, 'default' => null), - 'tag_id' => array('type' => 'integer', 'null' => false, 'default' => null), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'question_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), + 'tag_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( diff --git a/app/Test/Fixture/QueuedTaskFixture.php b/app/Test/Fixture/QueuedTaskFixture.php new file mode 100644 index 0000000..4844624 --- /dev/null +++ b/app/Test/Fixture/QueuedTaskFixture.php @@ -0,0 +1,38 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'job_type' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'data' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'group' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'reference' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'not_before' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'fetched' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'completed' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'failed' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 10, 'unsigned' => true), + 'failure_message' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'worker_key' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'created' => array('type' => 'datetime', 'null' => false, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array(); + +} diff --git a/app/Test/Fixture/RoleFixture.php b/app/Test/Fixture/RoleFixture.php new file mode 100644 index 0000000..bbf2b3a --- /dev/null +++ b/app/Test/Fixture/RoleFixture.php @@ -0,0 +1,39 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => Role::USER, + 'name' => 'Ontwikkelaar' + ), + array( + 'id' => Role::ADMIN, + 'name' => 'Administrator' + ), + ); + +} diff --git a/app/Test/Fixture/SubjectFixture.php b/app/Test/Fixture/SubjectFixture.php index 3c0adfb..7afeb31 100644 --- a/app/Test/Fixture/SubjectFixture.php +++ b/app/Test/Fixture/SubjectFixture.php @@ -1,7 +1,6 @@ array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'primary'), - 'exam_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => false, 'key' => 'index'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'exam_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'index'), 'value' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'is_second_version' => array('type' => 'boolean', 'null' => false, 'default' => null), 'indexes' => array( @@ -46,6 +45,18 @@ class SubjectFixture extends CakeTestFixture { 'value' => '10825363', 'is_second_version' => false ), + array( + 'id' => 1000000, + 'exam_id' => 1, + 'value' => '1000000', + 'is_second_version' => false + ), + array( + 'id' => 1000001, + 'exam_id' => 1, + 'value' => '1000001', + 'is_second_version' => false + ), ); } diff --git a/app/Test/Fixture/TagFixture.php b/app/Test/Fixture/TagFixture.php index 41f3c10..090793d 100644 --- a/app/Test/Fixture/TagFixture.php +++ b/app/Test/Fixture/TagFixture.php @@ -1,7 +1,6 @@ array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'index'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( diff --git a/app/Test/Fixture/TipFixture.php b/app/Test/Fixture/TipFixture.php new file mode 100644 index 0000000..d2be7bb --- /dev/null +++ b/app/Test/Fixture/TipFixture.php @@ -0,0 +1,29 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'unsigned' => true, 'key' => 'primary'), + 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'content' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array(); + +} diff --git a/app/Test/Fixture/UserFixture.php b/app/Test/Fixture/UserFixture.php index 37ee01d..281e7b7 100644 --- a/app/Test/Fixture/UserFixture.php +++ b/app/Test/Fixture/UserFixture.php @@ -3,8 +3,7 @@ App::uses('Security', 'Utility'); /** - * UserFixture - * + * User Fixture */ class UserFixture extends CakeTestFixture { @@ -14,11 +13,11 @@ class UserFixture extends CakeTestFixture { * @var array */ public $fields = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'username' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'password' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'role_id' => array('type' => 'integer', 'null' => true, 'default' => null), + 'role_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), 'surfconext_identifier' => array('type' => 'string', 'null' => true, 'default' => null, 'key' => 'unique', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1),