Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getTestMapWithTemplateAndScore() {
- if (null === $this->_testMapWithTemplateAndScore) {
- $testTemplate = $this->getTestTemplate();
- $testMapWithClientAnswer = $this->getTestMapWithClientAnswer();
- $testTemplateMap = $testTemplate->getTestTemplateMap();
- $testMapWithTemplateAndScore = $testMapWithClientAnswer;
- $testMapWithTemplateAndScore['test_section'] = array_combine(array_keys($testMapWithClientAnswer['test_section']), array_values($testTemplateMap['test_form_templatesection']));
- $testMapWithTemplateAndScore['test_score'] = 0;
- $testMapWithTemplateAndScore['test_min_score'] = 0;
- $testMapWithTemplateAndScore['test_max_score'] = 0;
- $stringHelper = Teemo::helper('teemo/string');
- $testScoreSheetMapper = new Test_Model_Mapper_ScoreSheet();
- $testScoreMapper = new Test_Model_Mapper_Score();
- $sectionRelatedCategoryIds = array();
- $testSubscoreArray = array();
- $testSiblingChildCategoryBelongsToSubscoreArray = array();
- $relatedScoreRate = (int)Core_Model_Setting::getValue('TEST-RELATED-SCORE-RATE');
- $testScoreSheetsWithTestScoreCode = $testScoreSheetMapper->fetchByFields(array('active' => true, 'test_type_id' => $testTemplate->getTestTypeId(), 'test_score_sheet_type_id' => Test_Model_ScoreSheetType::getScoreSheetTypeByCode(Test_Model_ScoreSheetType::TEST_SCORE_CODE)->getId()));
- $testScoreSheetIdWithTestScoreCode = $testScoreSheetsWithTestScoreCode->count() > 0 ? $testScoreSheetsWithTestScoreCode->first()->getId() : null;
- $testScoresWithTestScoreCode = $testScoreMapper->fetchByFields(array('test_score_sheet_id' => $testScoreSheetIdWithTestScoreCode))->sort('raw_score desc');
- $maxRawScoreWithTestScoreCode = $testScoresWithTestScoreCode->count() > 0 ? (int)$testScoresWithTestScoreCode->first()->getRawScore() : 0;
- $minRawScoreWithTestScoreCode = $testScoresWithTestScoreCode->count() > 0 ? (int)$testScoresWithTestScoreCode->last()->getRawScore() : 0;
- $testScoreSheetsWithCrossTestScoreCode = $testScoreSheetMapper->fetchByFields(array('active' => true, 'test_type_id' => $testTemplate->getTestTypeId(), 'test_score_sheet_type_id' => Test_Model_ScoreSheetType::getScoreSheetTypeByCode(Test_Model_ScoreSheetType::CROSS_TEST_SCORE_CODE)->getId()));
- $testScoreSheetIdWithCrossTestScoreCode = $testScoreSheetsWithCrossTestScoreCode->count() > 0 ? $testScoreSheetsWithCrossTestScoreCode->first()->getId() : null;
- $testScoresWithCrossTestScoreCode = $testScoreMapper->fetchByFields(array('test_score_sheet_id' => $testScoreSheetIdWithCrossTestScoreCode))->sort('raw_score desc');
- $maxRawScoreWithCrossTestScoreCode = $testScoresWithCrossTestScoreCode->count() > 0 ? (int)$testScoresWithCrossTestScoreCode->first()->getRawScore() : 0;
- $minRawScoreWithCrossTestScoreCode = $testScoresWithCrossTestScoreCode->count() > 0 ? (int)$testScoresWithCrossTestScoreCode->last()->getRawScore() : 0;
- $testScoreSheetsWithSubscoreCode = $testScoreSheetMapper->fetchByFields(array('active' => true, 'test_type_id' => $testTemplate->getTestTypeId(), 'test_score_sheet_type_id' => Test_Model_ScoreSheetType::getScoreSheetTypeByCode(Test_Model_ScoreSheetType::SUBSCORE_CODE)->getId()));
- $testScoreSheetIdWithSubscoreCode = $testScoreSheetsWithSubscoreCode->count() > 0 ? $testScoreSheetsWithSubscoreCode->first()->getId() : null;
- $testScoresWithSubscoreCode = $testScoreMapper->fetchByFields(array('test_score_sheet_id' => $testScoreSheetIdWithSubscoreCode))->sort('raw_score desc');
- $maxRawScoreWithSubscoreCode = $testScoresWithSubscoreCode->count() > 0 ? (int)$testScoresWithSubscoreCode->first()->getRawScore() : 0;
- $minRawScoreWithSubscoreCode = $testScoresWithSubscoreCode->count() > 0 ? (int)$testScoresWithSubscoreCode->last()->getRawScore() : 0;
- $colourMap = Test_Model_AnswerType::getTestReportAnswerTypeColorMap();
- $correctAnswerName = Test_Model_AnswerType::getAnswerTypeByCode(Test_Model_AnswerType::CORRECT_CODE)->getName();
- $incorrectAnswerName = Test_Model_AnswerType::getAnswerTypeByCode(Test_Model_AnswerType::INCORRECT_CODE)->getName();
- foreach ($testMapWithClientAnswer['test_section'] as $testSectionId => $testSectionMap) {
- $testSection = new Test_Model_Section();
- $testSection->find($testSectionId);
- $testQuestionIds = $testSection->getTestQuestions()->getIds();
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_question_count'] = count($testQuestionIds);
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_raw_score'] = 0;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_incorrect'] = 0;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_omitted'] = 0;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_notes'] = $testSectionMap['notes'];
- foreach ($testSectionMap['client_answer'] as $index => $clientAnswer) {
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['client_answer'] = $clientAnswer;
- if (isset($clientAnswer) && $clientAnswer !== null) {
- if ($this->isCorrectAnswer($clientAnswer, $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['test_choice_format_option_id'], $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['grid_in_answer'])) {
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_raw_score'] = 1;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_raw_score']++;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['responses'][$testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_name']][$index]['colour'] = $colourMap[$correctAnswerName];
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['responses'][$testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_name']][$index]['response'] = '+';
- } else {
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_incorrect'] = 1;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_incorrect']++;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['responses'][$testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_name']][$index]['colour'] = $colourMap[$incorrectAnswerName];
- $response = new Test_Model_ChoiceFormatOption();
- $response->find($clientAnswer);
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['responses'][$testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_name']][$index]['response'] = $response->getId() ? $response->getName() : $clientAnswer;
- }
- } else {
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_omitted'] = 1;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_omitted']++;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['responses'][$testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_name']][$index]['colour'] = '#000';
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['responses'][$testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_name']][$index]['response'] = '';
- }
- $correctAnswer = new Test_Model_ChoiceFormatOption();
- $correctAnswer = $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['grid_in_answer'] !== null ? $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['grid_in_answer'] : $correctAnswer->find($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['test_choice_format_option_id']);
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['responses'][$testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_name']][$index]['question_num'] = $index + 1;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['responses'][$testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_name']][$index]['correct_answer'] = $correctAnswer instanceof Test_Model_ChoiceFormatOption ? $correctAnswer->getName() : $correctAnswer;
- $templateQuestion = new Test_Model_TemplateQuestion();
- $templateQuestion->find($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['test_template_question_id']);
- $testTemplateQuestionCategoryNames = array();
- foreach ($templateQuestion->getTestTemplateQuestionCategories() as $testTemplateQuestionCategory) {
- $testTemplateQuestionCategoryName = $testTemplateQuestionCategory->getTestCategory()->getName();
- if (!in_array($testTemplateQuestionCategoryName, $testTemplateQuestionCategoryNames)) {
- $testTemplateQuestionCategoryNames[] = $testTemplateQuestionCategoryName;
- }
- }
- sort($testTemplateQuestionCategoryNames);
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['responses'][$testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_name']][$index]['categories'] = implode(', ', $testTemplateQuestionCategoryNames);
- $testCrossTestScoreId = $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['test_cross_test_score_id'];
- if ($testCrossTestScoreId) {
- $testCrossTestScore = new Test_Model_CrossTestScore();
- $testCrossTestScore->find($testCrossTestScoreId);
- $testMapWithTemplateAndScore['test_cross_test_score'][$testCrossTestScoreId]['test_cross_test_score_name'] = $testCrossTestScore->getName();
- $testMapWithTemplateAndScore['test_cross_test_score'][$testCrossTestScoreId]['test_cross_test_score_count']++;
- if ($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_raw_score']) {
- $testMapWithTemplateAndScore['test_cross_test_score'][$testCrossTestScoreId]['test_cross_test_score_raw_score']++;
- }
- if ($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_incorrect']) {
- $testMapWithTemplateAndScore['test_cross_test_score'][$testCrossTestScoreId]['test_cross_test_score_incorrect']++;
- }
- if ($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_omitted']) {
- $testMapWithTemplateAndScore['test_cross_test_score'][$testCrossTestScoreId]['test_cross_test_score_omitted']++;
- }
- }
- $testSubscoreId = $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['test_subscore_id'];
- if ($testSubscoreId) {
- $testSubscore = new Test_Model_Subscore();
- $testSubscore->find($testSubscoreId);
- $testMapWithTemplateAndScore['test_subscore'][$testSubscoreId]['test_subscore_name'] = $testSubscore->getName();
- $testMapWithTemplateAndScore['test_subscore'][$testSubscoreId]['test_subscore_count']++;
- if ($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_raw_score']) {
- $testMapWithTemplateAndScore['test_subscore'][$testSubscoreId]['test_subscore_raw_score']++;
- }
- if ($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_incorrect']) {
- $testMapWithTemplateAndScore['test_subscore'][$testSubscoreId]['test_subscore_incorrect']++;
- }
- if ($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_omitted']) {
- $testMapWithTemplateAndScore['test_subscore'][$testSubscoreId]['test_subscore_omitted']++;
- }
- }
- foreach ($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_category'] as $testQuestionCategoryIndex => $testQuestionCategory) {
- $questionCategoryId = $testQuestionCategory['question_category_id'];
- $questionCategory = new Test_Model_Category();
- $questionCategory->find($questionCategoryId);
- $questionCategoryName = $questionCategory->getName();
- $questionCategoryBelongToSubscore = $questionCategory->getBelongToSubscore();
- $questionCategoryTestCategoryTypeId = $questionCategory->getTestCategoryTypeId();
- $isGrandchildCategory = $questionCategory->isGrandchildCategory();
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['test_category_type_id'] = $questionCategoryTestCategoryTypeId ? : '';
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['test_category_type_name'] = $questionCategoryTestCategoryTypeId ? $questionCategory->getTestCategoryType()->getName() : '';
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_name'] = $questionCategoryName;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_belong_to_subscore'] = $questionCategoryBelongToSubscore;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['is_grandchild_category'] = $isGrandchildCategory;
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['parent_id_of_grandchild_category'] = $isGrandchildCategory ? $questionCategory->getParentId() : '';
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['parent_name_of_grandchild_category'] = $isGrandchildCategory ? $questionCategory->getParentTestCategory()->getName() : '';
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_count']++;
- if ($questionCategoryBelongToSubscore) {
- $testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore'][$questionCategoryId]['question_category_name'] = $questionCategoryName;
- $testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore'][$questionCategoryId]['question_category_count']++;
- }
- if ($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_raw_score']) {
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_raw_score']++;
- if ($questionCategoryBelongToSubscore) {
- $testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore'][$questionCategoryId]['question_category_raw_score']++;
- }
- }
- if ($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_incorrect']) {
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_incorrect']++;
- if ($questionCategoryBelongToSubscore) {
- $testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore'][$questionCategoryId]['question_category_incorrect']++;
- }
- }
- if ($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'][$index]['question_omitted']) {
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_omitted']++;
- if ($questionCategoryBelongToSubscore) {
- $testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore'][$questionCategoryId]['question_category_omitted']++;
- }
- }
- }
- }
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion'] = array_combine(array_values($testQuestionIds), array_values($testMapWithTemplateAndScore['test_section'][$testSectionId]['test_form_templatequestion']));
- $sectionTestCategoryId = $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_id'];
- $sectionParentCategoryId = $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_parent_category_id'];
- $testCategory = new Test_Model_Category();
- $testCategory->find($sectionTestCategoryId);
- if ($testCategory->getIsSubcategory()) {
- $sectionTestCategoryId = $testCategory->getParentId();
- }
- $scoreArray = $this->getScores(Test_Model_ScoreSheetType::TEST_SCORE_CODE, $testScoreSheetIdWithTestScoreCode, $sectionTestCategoryId, $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_raw_score'], $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_question_count'], $maxRawScoreWithTestScoreCode, $minRawScoreWithTestScoreCode);
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_score'] = $scoreArray['section_score'];
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_min_score'] = $scoreArray['section_min_score'];
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_min_raw_score'] = $scoreArray['section_min_raw_score'];
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_max_score'] = $scoreArray['section_max_score'];
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_max_raw_score'] = $scoreArray['section_max_raw_score'];
- $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_category_name'] = $testCategory->getName();
- if (!$sectionParentCategoryId) {
- $sectionRelatedCategoryId = $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_related_category_id'];
- $testMapWithTemplateAndScore['test_score'] = is_numeric($testMapWithTemplateAndScore['test_section'][$testSectionId]['section_score']) ? ($sectionRelatedCategoryId ? $relatedScoreRate * $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_score'] + $testMapWithTemplateAndScore['test_score'] : $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_score'] + $testMapWithTemplateAndScore['test_score']) : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['test_min_score'] = is_numeric($testMapWithTemplateAndScore['test_section'][$testSectionId]['section_min_score']) ? ($sectionRelatedCategoryId ? $relatedScoreRate * $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_min_score'] + $testMapWithTemplateAndScore['test_min_score'] : $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_min_score'] + $testMapWithTemplateAndScore['test_min_score']) : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['test_max_score'] = is_numeric($testMapWithTemplateAndScore['test_section'][$testSectionId]['section_max_score']) ? ($sectionRelatedCategoryId ? $relatedScoreRate * $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_max_score'] + $testMapWithTemplateAndScore['test_max_score'] : $testMapWithTemplateAndScore['test_section'][$testSectionId]['section_max_score'] + $testMapWithTemplateAndScore['test_max_score']) : $stringHelper->get('N/A');
- }
- }
- if ($testMapWithTemplateAndScore['test_cross_test_score']) {
- foreach ($testMapWithTemplateAndScore['test_cross_test_score'] as $testCrossTestScoreId => $testCrossTestScore) {
- $testCrossTestScoreArray = array(
- 'test_cross_test_score_name' => $testCrossTestScore['test_cross_test_score_name'],
- 'test_cross_test_score_count' => $testCrossTestScore['test_cross_test_score_count'],
- 'test_cross_test_score_raw_score' => $testCrossTestScore['test_cross_test_score_raw_score'] ? : 0,
- 'test_cross_test_score_incorrect' => $testCrossTestScore['test_cross_test_score_incorrect'] ? : 0,
- 'test_cross_test_score_omitted' => $testCrossTestScore['test_cross_test_score_omitted'] ? : 0,
- );
- $scoreArray = $this->getScores(Test_Model_ScoreSheetType::CROSS_TEST_SCORE_CODE, $testScoreSheetIdWithCrossTestScoreCode, $testCrossTestScoreId, $testCrossTestScoreArray['test_cross_test_score_raw_score'], $testCrossTestScoreArray['test_cross_test_score_count'], $maxRawScoreWithCrossTestScoreCode, $minRawScoreWithCrossTestScoreCode);
- $testCrossTestScoreArray['test_cross_test_score_score'] = $scoreArray['section_score'];
- $testCrossTestScoreArray['test_cross_test_score_min_score'] = $scoreArray['section_min_score'];
- $testCrossTestScoreArray['test_cross_test_score_min_raw_score'] = $scoreArray['section_min_raw_score'];
- $testCrossTestScoreArray['test_cross_test_score_max_score'] = $scoreArray['section_max_score'];
- $testCrossTestScoreArray['test_cross_test_score_max_raw_score'] = $scoreArray['section_max_raw_score'];
- $testMapWithTemplateAndScore['test_cross_test_score'][$testCrossTestScoreId] = $testCrossTestScoreArray;
- }
- }
- if ($testMapWithTemplateAndScore['test_subscore']) {
- foreach ($testMapWithTemplateAndScore['test_subscore'] as $testSubscoreId => $testSubscore) {
- $testSubscoreArray = array(
- 'test_subscore_name' => $testSubscore['test_subscore_name'],
- 'test_subscore_count' => $testSubscore['test_subscore_count'],
- 'test_subscore_raw_score' => $testSubscore['test_subscore_raw_score'] ? : 0,
- 'test_subscore_incorrect' => $testSubscore['test_subscore_incorrect'] ? : 0,
- 'test_subscore_omitted' => $testSubscore['test_subscore_omitted'] ? : 0,
- );
- $scoreArray = $this->getScores(Test_Model_ScoreSheetType::SUBSCORE_CODE, $testScoreSheetIdWithSubscoreCode, $testSubscoreId, $testSubscoreArray['test_subscore_raw_score'], $testSubscoreArray['test_subscore_count'], $maxRawScoreWithSubscoreCode, $minRawScoreWithSubscoreCode);
- $testSubscoreArray['test_subscore_score'] = $scoreArray['section_score'];
- $testSubscoreArray['test_subscore_min_score'] = $scoreArray['section_min_score'];
- $testSubscoreArray['test_subscore_min_raw_score'] = $scoreArray['section_min_raw_score'];
- $testSubscoreArray['test_subscore_max_score'] = $scoreArray['section_max_score'];
- $testSubscoreArray['test_subscore_max_raw_score'] = $scoreArray['section_max_raw_score'];
- $testMapWithTemplateAndScore['test_subscore'][$testSubscoreId] = $testSubscoreArray;
- }
- }
- if ($testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore']) {
- foreach ($testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore'] as $testCategoryId => $testCategory) {
- $testCategoryArray = array(
- 'test_subscore_name' => $testCategory['question_category_name'],
- 'test_subscore_count' => $testCategory['question_category_count'],
- 'test_subscore_raw_score' => $testCategory['question_category_raw_score'] ? : 0,
- 'test_subscore_incorrect' => $testCategory['question_category_incorrect'] ? : 0,
- 'test_subscore_omitted' => $testCategory['question_category_omitted'] ? : 0,
- );
- $scoreArray = $this->getScores(Test_Model_ScoreSheetType::SUBSCORE_CODE, $testScoreSheetIdWithSubscoreCode, $testCategoryId, $testCategoryArray['test_subscore_raw_score'], $testCategoryArray['test_subscore_count'], $maxRawScoreWithSubscoreCode, $minRawScoreWithSubscoreCode, true);
- $testCategoryArray['test_subscore_score'] = $scoreArray['section_score'];
- $testCategoryArray['test_subscore_min_score'] = $scoreArray['section_min_score'];
- $testCategoryArray['test_subscore_min_raw_score'] = $scoreArray['section_min_raw_score'];
- $testCategoryArray['test_subscore_max_score'] = $scoreArray['section_max_score'];
- $testCategoryArray['test_subscore_max_raw_score'] = $scoreArray['section_max_raw_score'];
- $testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore'][$testCategoryId] = $testCategoryArray;
- }
- }
- if ($testMapWithTemplateAndScore['test_subscore']) {
- $testSubscoreArray = array_values($testMapWithTemplateAndScore['test_subscore']);
- }
- if ($testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore']) {
- ksort($testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore']);
- $testSiblingChildCategoryBelongsToSubscoreArray = array_values($testMapWithTemplateAndScore['test_sibling_child_category_belongs_to_subscore']);
- }
- $testMapWithTemplateAndScore['test_subscore_merged'] = array_merge($testSubscoreArray, $testSiblingChildCategoryBelongsToSubscoreArray);
- foreach ($testMapWithTemplateAndScore['test_section'] as $sectionId => $testSection) {
- if ($testSection['section_performance_by_question_category_report']) {
- foreach ($testSection['section_performance_by_question_category_report'] as $questionCategoryId => $questionCategory) {
- $questionCategoryArray = array(
- 'question_category_name' => $questionCategory['question_category_name'],
- 'question_category_count' => $questionCategory['question_category_count'],
- 'question_category_raw_score' => $questionCategory['question_category_raw_score'] ? : 0,
- 'question_category_incorrect' => $questionCategory['question_category_incorrect'] ? : 0,
- 'question_category_omitted' => $questionCategory['question_category_omitted'] ? : 0,
- 'test_category_type_id' => $questionCategory['test_category_type_id'],
- 'test_category_type_name' => $questionCategory['test_category_type_name'],
- 'question_category_belong_to_subscore' => $questionCategory['question_category_belong_to_subscore'],
- 'is_grandchild_category' => $questionCategory['is_grandchild_category'],
- 'parent_id_of_grandchild_category' => $questionCategory['parent_id_of_grandchild_category'],
- 'parent_name_of_grandchild_category' => $questionCategory['parent_name_of_grandchild_category']
- );
- $testMapWithTemplateAndScore['test_section'][$sectionId]['section_performance_by_question_category_report'][$questionCategoryId] = $questionCategoryArray;
- if ($questionCategory['test_category_type_id']) {
- if ($questionCategory['is_grandchild_category']) {
- $testMapWithTemplateAndScore['test_section'][$sectionId]['section_performance_by_category_type_report_for_parent_of_grandchild_category'][$questionCategory['parent_id_of_grandchild_category']]['parent_name_of_grandchild_category'] = $questionCategory['parent_name_of_grandchild_category'];
- $testMapWithTemplateAndScore['test_section'][$sectionId]['section_performance_by_category_type_report_for_parent_of_grandchild_category'][$questionCategory['parent_id_of_grandchild_category']]['test_category_type_report_for_parent_of_grandchild_category'][$questionCategory['test_category_type_id']]['test_category_type_name'] = $questionCategory['test_category_type_name'];
- $testMapWithTemplateAndScore['test_section'][$sectionId]['section_performance_by_category_type_report_for_parent_of_grandchild_category'][$questionCategory['parent_id_of_grandchild_category']]['test_category_type_report_for_parent_of_grandchild_category'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId] = array(
- 'question_category_name' => $questionCategory['question_category_name'],
- 'question_category_count' => $questionCategory['question_category_count'],
- 'question_category_raw_score' => $questionCategory['question_category_raw_score'] ? : 0,
- 'question_category_incorrect' => $questionCategory['question_category_incorrect'] ? : 0,
- 'question_category_omitted' => $questionCategory['question_category_omitted'] ? : 0,
- 'is_grandchild_category' => $questionCategory['is_grandchild_category'],
- 'parent_id_of_grandchild_category' => $questionCategory['parent_id_of_grandchild_category'],
- 'parent_name_of_grandchild_category' => $questionCategory['parent_name_of_grandchild_category']
- );
- $testMapWithTemplateAndScore['test_section'][$sectionId]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategory['parent_id_of_grandchild_category']]['question_category_name'] = $questionCategory['parent_name_of_grandchild_category'];
- $testMapWithTemplateAndScore['test_section'][$sectionId]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategory['parent_id_of_grandchild_category']]['question_category_count'] += $questionCategory['question_category_count'];
- $testMapWithTemplateAndScore['test_section'][$sectionId]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategory['parent_id_of_grandchild_category']]['question_category_raw_score'] += $questionCategory['question_category_raw_score'];
- $testMapWithTemplateAndScore['test_section'][$sectionId]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategory['parent_id_of_grandchild_category']]['question_category_incorrect'] += $questionCategory['question_category_incorrect'];
- $testMapWithTemplateAndScore['test_section'][$sectionId]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategory['parent_id_of_grandchild_category']]['question_category_omitted'] += $questionCategory['question_category_omitted'];
- } else {
- $testMapWithTemplateAndScore['test_section'][$sectionId]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_name'] = $questionCategory['test_category_type_name'];
- $testMapWithTemplateAndScore['test_section'][$sectionId]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId] = array(
- 'question_category_name' => $questionCategory['question_category_name'],
- 'question_category_count' => $questionCategory['question_category_count'],
- 'question_category_raw_score' => $questionCategory['question_category_raw_score'] ? : 0,
- 'question_category_incorrect' => $questionCategory['question_category_incorrect'] ? : 0,
- 'question_category_omitted' => $questionCategory['question_category_omitted'] ? : 0,
- 'is_grandchild_category' => $questionCategory['is_grandchild_category'],
- 'parent_id_of_grandchild_category' => $questionCategory['parent_id_of_grandchild_category'],
- 'parent_name_of_grandchild_category' => $questionCategory['parent_name_of_grandchild_category']
- );
- }
- }
- }
- }
- if ($testSection['section_parent_category_id']) {
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_category_id'] = $testSection['section_parent_category_id'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_category_name'] = $testSection['section_parent_category_name'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_notes'] = sprintf('<strong>%s:</strong> %s<br>%s', $testSection['section_category_name'], $testSection['section_notes'], $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_notes']);
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_question_count'] += $testSection['section_question_count'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_raw_score'] += $testSection['section_raw_score'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_incorrect'] += $testSection['section_incorrect'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_omitted'] += $testSection['section_omitted'];
- $scoreArray = $this->getScores(Test_Model_ScoreSheetType::TEST_SCORE_CODE, $testScoreSheetIdWithTestScoreCode, $testSection['section_parent_category_id'], $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_raw_score'], $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_question_count'], $maxRawScoreWithTestScoreCode, $minRawScoreWithTestScoreCode);
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_score'] = $scoreArray['section_score'] / ($relatedScoreRate * 2);
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_min_score'] = $scoreArray['section_min_score'] / ($relatedScoreRate * 2);
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_min_raw_score'] = $scoreArray['section_min_raw_score'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_max_score'] = $scoreArray['section_max_score'] / ($relatedScoreRate * 2);
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_max_raw_score'] = $scoreArray['section_max_raw_score'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_score_converted'] = $scoreArray['section_score'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_min_score_converted'] = $scoreArray['section_min_score'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_max_score_converted'] = $scoreArray['section_max_score'];
- foreach ($testSection['responses'] as $response) {
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['responses'][$testMapWithTemplateAndScore['test_section'][$sectionId]['section_category_name']] = $response;
- }
- $testCategory = new Test_Model_Category();
- $testCategory->find($testSection['section_parent_category_id']);
- if ($testCategory->getId()) {
- $relatedTestCategory = $testCategory->getRelatedTestCategory();
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_related_category_id'] = $relatedTestCategory->getId();
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_related_category_name'] = $relatedTestCategory->getName();
- }
- foreach ($testSection['section_performance_by_question_category_report'] as $questionCategoryId => $questionCategory) {
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_name'] = $questionCategory['question_category_name'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_count'] += $questionCategory['question_category_count'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_raw_score'] += $questionCategory['question_category_raw_score'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_incorrect'] += $questionCategory['question_category_incorrect'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_omitted'] += $questionCategory['question_category_omitted'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['test_category_type_id'] = $questionCategory['test_category_type_id'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['test_category_type_name'] = $questionCategory['test_category_type_name'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['question_category_belong_to_subscore'] = $questionCategory['question_category_belong_to_subscore'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['is_grandchild_category'] = $questionCategory['is_grandchild_category'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['parent_id_of_grandchild_category'] = $questionCategory['parent_id_of_grandchild_category'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_question_category_report'][$questionCategoryId]['parent_name_of_grandchild_category'] = $questionCategory['parent_name_of_grandchild_category'];
- if ($questionCategory['test_category_type_id']) {
- if ($questionCategory['is_grandchild_category']) {
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_category_type_report_for_parent_of_grandchild_category'][$questionCategory['parent_id_of_grandchild_category']]['parent_name_of_grandchild_category'] = $questionCategory['parent_name_of_grandchild_category'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_category_type_report_for_parent_of_grandchild_category'][$questionCategory['parent_id_of_grandchild_category']]['test_category_type_report_for_parent_of_grandchild_category'][$questionCategory['test_category_type_id']]['test_category_type_name'] = $questionCategory['test_category_type_name'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_category_type_report_for_parent_of_grandchild_category'][$questionCategory['parent_id_of_grandchild_category']]['test_category_type_report_for_parent_of_grandchild_category'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId]['question_category_name'] = $questionCategory['question_category_name'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_category_type_report_for_parent_of_grandchild_category'][$questionCategory['parent_id_of_grandchild_category']]['test_category_type_report_for_parent_of_grandchild_category'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId]['question_category_count'] += $questionCategory['question_category_count'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_category_type_report_for_parent_of_grandchild_category'][$questionCategory['parent_id_of_grandchild_category']]['test_category_type_report_for_parent_of_grandchild_category'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId]['question_category_raw_score'] += $questionCategory['question_category_raw_score'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_category_type_report_for_parent_of_grandchild_category'][$questionCategory['parent_id_of_grandchild_category']]['test_category_type_report_for_parent_of_grandchild_category'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId]['question_category_incorrect'] += $questionCategory['question_category_incorrect'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['section_performance_by_category_type_report_for_parent_of_grandchild_category'][$questionCategory['parent_id_of_grandchild_category']]['test_category_type_report_for_parent_of_grandchild_category'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId]['question_category_omitted'] += $questionCategory['question_category_omitted'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategory['parent_id_of_grandchild_category']]['question_category_name'] = $questionCategory['parent_name_of_grandchild_category'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategory['parent_id_of_grandchild_category']]['question_category_count'] += $questionCategory['question_category_count'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategory['parent_id_of_grandchild_category']]['question_category_raw_score'] += $questionCategory['question_category_raw_score'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategory['parent_id_of_grandchild_category']]['question_category_incorrect'] += $questionCategory['question_category_incorrect'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategory['parent_id_of_grandchild_category']]['question_category_omitted'] += $questionCategory['question_category_omitted'];
- } else {
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_name'] = $questionCategory['test_category_type_name'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId]['question_category_name'] = $questionCategory['question_category_name'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId]['question_category_count'] += $questionCategory['question_category_count'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId]['question_category_raw_score'] += $questionCategory['question_category_raw_score'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId]['question_category_incorrect'] += $questionCategory['question_category_incorrect'];
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['test_category_type_report'][$questionCategoryId]['question_category_omitted'] += $questionCategory['question_category_omitted'];
- }
- $testMapWithTemplateAndScore['parent_category'][$testSection['section_parent_category_id']]['child_section_category_type_reports'][$sectionId]['section_performance_by_category_type_report'][$questionCategory['test_category_type_id']]['section_name'] = str_replace(sprintf('%s - ', $testCategory->getName()), '', $testMapWithTemplateAndScore['test_section'][$sectionId]['section_category_name']);
- }
- }
- }
- $sectionRelatedCategoryIds[] = $testSection['section_related_category_id'];
- if ($testSection['section_related_category_id'] && !in_array($testSection['section_category_id'], $sectionRelatedCategoryIds)) {
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_category_id'] = $testSection['section_category_id'];
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_related_category_id'] = $testSection['section_related_category_id'];
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_category_name'] = $stringHelper->get('Evidence Based %s, %s', $testSection['section_category_name'], $testSection['section_related_category_name']);
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_score'] = is_numeric($testSection['section_score']) ? $testSection['section_score'] * $relatedScoreRate : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_min_score'] = is_numeric($testSection['section_min_score']) ? $testSection['section_min_score'] * $relatedScoreRate : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_max_score'] = is_numeric($testSection['section_max_score']) ? $testSection['section_max_score'] * $relatedScoreRate : $stringHelper->get('N/A');
- foreach ($testMapWithTemplateAndScore['test_section'] as $sectionIdRelated => $testSectionRelated) {
- if ($testSectionRelated['section_category_id'] === $testSection['section_related_category_id']) {
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_score'] = is_numeric($testSection['section_score']) && is_numeric($testSectionRelated['section_score']) ? ($testSection['section_score'] + $testSectionRelated['section_score']) * $relatedScoreRate : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_min_score'] = is_numeric($testSection['section_min_score']) && is_numeric($testSectionRelated['section_min_score']) ? ($testSection['section_min_score'] + $testSectionRelated['section_min_score']) * $relatedScoreRate : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_max_score'] = is_numeric($testSection['section_max_score']) && is_numeric($testSectionRelated['section_max_score']) ? ($testSection['section_max_score'] + $testSectionRelated['section_max_score']) * $relatedScoreRate : $stringHelper->get('N/A');
- }
- }
- }
- }
- foreach ($testMapWithTemplateAndScore['related_category'] as $testCategoryId => $testSection) {
- foreach ($testMapWithTemplateAndScore['parent_category'] as $testCategoryIdRelated => $testSectionRelated) {
- if ((int)$testSection['section_related_category_id'] === $testCategoryIdRelated) {
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_score'] = is_numeric($testSection['section_score']) && is_numeric($testSectionRelated['section_score']) ? $testSection['section_score'] + $testSectionRelated['section_score'] * $relatedScoreRate : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_min_score'] = is_numeric($testSection['section_min_score']) && is_numeric($testSectionRelated['section_min_score']) ? $testSection['section_min_score'] + $testSectionRelated['section_min_score'] * $relatedScoreRate : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['related_category'][$testSection['section_category_id']]['section_max_score'] = is_numeric($testSection['section_max_score']) && is_numeric($testSectionRelated['section_max_score']) ? $testSection['section_max_score'] + $testSectionRelated['section_max_score'] * $relatedScoreRate : $stringHelper->get('N/A');
- }
- }
- }
- $sectionRelatedCategoryIds[] = array();
- foreach ($testMapWithTemplateAndScore['parent_category'] as $testCategoryId => $testSection) {
- $sectionRelatedCategoryIds[] = $testSection['section_related_category_id'];
- if (!in_array($testCategoryId, $sectionRelatedCategoryIds)) {
- foreach ($testMapWithTemplateAndScore['parent_category'] as $testCategoryIdRelated => $testSectionRelated) {
- if ((int)$testSection['section_related_category_id'] === $testCategoryIdRelated) {
- $testMapWithTemplateAndScore['related_category'][$testCategoryId]['section_category_id'] = $testCategoryId;
- $testMapWithTemplateAndScore['related_category'][$testCategoryId]['section_related_category_id'] = $testSection['section_related_category_id'];
- $testMapWithTemplateAndScore['related_category'][$testCategoryId]['section_category_name'] = $stringHelper->get('%s and %s', $testSection['section_category_name'], $testSection['section_related_category_name']);
- $testMapWithTemplateAndScore['related_category'][$testCategoryId]['section_score'] = is_numeric($testSection['section_score']) && is_numeric($testSectionRelated['section_score']) ? ($testSection['section_score'] + $testSectionRelated['section_score']) * $relatedScoreRate : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['related_category'][$testCategoryId]['section_min_score'] = is_numeric($testSection['section_min_score']) && is_numeric($testSectionRelated['section_min_score']) ? ($testSection['section_min_score'] + $testSectionRelated['section_min_score']) * $relatedScoreRate : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['related_category'][$testCategoryId]['section_max_score'] = is_numeric($testSection['section_max_score']) && is_numeric($testSectionRelated['section_max_score']) ? ($testSection['section_max_score'] + $testSectionRelated['section_max_score']) * $relatedScoreRate : $stringHelper->get('N/A');
- }
- }
- }
- $testMapWithTemplateAndScore['test_score'] = is_numeric($testSection['section_score']) ? ($testSection['section_related_category_id'] ? $relatedScoreRate * $testSection['section_score'] + $testMapWithTemplateAndScore['test_score'] : $testSection['section_score_converted'] + $testMapWithTemplateAndScore['test_score']) : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['test_min_score'] = is_numeric($testSection['section_min_score']) ? ($testSection['section_related_category_id'] ? $relatedScoreRate * $testSection['section_min_score'] + $testMapWithTemplateAndScore['test_min_score'] : $testSection['section_min_score_converted'] + $testMapWithTemplateAndScore['test_min_score']) : $stringHelper->get('N/A');
- $testMapWithTemplateAndScore['test_max_score'] = is_numeric($testSection['section_max_score']) ? ($testSection['section_related_category_id'] ? $relatedScoreRate * $testSection['section_max_score'] + $testMapWithTemplateAndScore['test_max_score'] : $testSection['section_max_score_converted'] + $testMapWithTemplateAndScore['test_max_score']) : $stringHelper->get('N/A');
- }
- $this->_testMapWithTemplateAndScore = $testMapWithTemplateAndScore;
- }
- return $this->_testMapWithTemplateAndScore;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement