From 87fc213a3ef3153d5b9d2c8f7da9a75dacd85239 Mon Sep 17 00:00:00 2001 From: YUE YU Date: Tue, 10 Sep 2024 13:16:37 +0800 Subject: [PATCH] Assigning a number of papers --- relis_app/controllers/Data_extraction.php | 10 ++ relis_app/controllers/Quality_assessment.php | 10 ++ relis_app/controllers/Screening.php | 13 +- relis_app/controllers/test/Unit_test.php | 2 +- .../tests/data_extraction_ut_helper.php | 109 +++++++++++----- .../tests/helpers/functions_helper.php | 10 ++ .../tests/quality_assessment_ut_helper.php | 113 +++++++++++----- .../helpers/tests/screening_ut_helper.php | 123 +++++++++++++----- .../data_extraction/assign_papers_class.php | 35 ++++- .../quality_assessment/assign_papers_qa.php | 35 ++++- .../screening/assign_papers_screen_auto.php | 33 ++++- 11 files changed, 386 insertions(+), 107 deletions(-) diff --git a/relis_app/controllers/Data_extraction.php b/relis_app/controllers/Data_extraction.php index 77a1558e..8f81d1b8 100755 --- a/relis_app/controllers/Data_extraction.php +++ b/relis_app/controllers/Data_extraction.php @@ -968,6 +968,11 @@ function class_assignment_save() $reviews_per_paper = 1; $papers_all = $this->get_papers_for_classification(); $papers = $papers_all['papers_to_assign']; + if (isset($post_arr['assign_all_paper_checkbox']) && $post_arr['assign_all_paper_checkbox'] == 'off') { + $number_of_papers_to_assign = intval($post_arr['number_of_papers_to_assign']); + } else { + $number_of_papers_to_assign = count($papers); + } // print_test($papers); $papers_to_validate_nbr = round(count($papers) * $percentage / 100); $operation_description = "Assign papers for classification"; @@ -978,7 +983,11 @@ function class_assignment_save() $assign_papers = array(); $this->db2 = $this->load->database(project_db(), TRUE); $operation_code = active_user_id() . "_" . time(); + $assigned_count = 0; foreach ($papers as $key => $value) { + if ($assigned_count >= $number_of_papers_to_assign) { + break; + } if ($key < $papers_to_validate_nbr) { //$assign_papers[$key]['paper']=$value['id']; //$assign_papers[$key]['users']=array(); @@ -1002,6 +1011,7 @@ function class_assignment_save() $j++; } } + $assigned_count++; } //exit; // print_test(); diff --git a/relis_app/controllers/Quality_assessment.php b/relis_app/controllers/Quality_assessment.php index 8c32ee1e..f2f678c9 100755 --- a/relis_app/controllers/Quality_assessment.php +++ b/relis_app/controllers/Quality_assessment.php @@ -245,6 +245,11 @@ function qa_assignment_save() $reviews_per_paper = 1; $papers_all = $this->get_papers_for_qa(); $papers = $papers_all['papers_to_assign']; + if (isset($post_arr['assign_all_paper_checkbox']) && $post_arr['assign_all_paper_checkbox'] == 'off') { + $number_of_papers_to_assign = intval($post_arr['number_of_papers_to_assign']); + } else { + $number_of_papers_to_assign = count($papers); + } // print_test($papers); $papers_to_validate_nbr = round(count($papers) * $percentage / 100); $operation_description = "Assign papers for QA"; @@ -255,7 +260,11 @@ function qa_assignment_save() $assign_papers = array(); $this->db2 = $this->load->database(project_db(), TRUE); $operation_code = active_user_id() . "_" . time(); + $assigned_count = 0; foreach ($papers as $key => $value) { + if ($assigned_count >= $number_of_papers_to_assign) { + break; + } if ($key < $papers_to_validate_nbr) { //$assign_papers[$key]['paper']=$value['id']; //$assign_papers[$key]['users']=array(); @@ -279,6 +288,7 @@ function qa_assignment_save() $j++; } } + $assigned_count++; } //exit; // print_test(); diff --git a/relis_app/controllers/Screening.php b/relis_app/controllers/Screening.php index e5e7f43e..68fc7d60 100644 --- a/relis_app/controllers/Screening.php +++ b/relis_app/controllers/Screening.php @@ -792,7 +792,7 @@ function get_papers_to_screen($source = 'all', $source_status = 'all', $current_ function save_assignment_screen() { $post_arr = $this->input->post(); - // print_test($post_arr); exit; +// print_test($post_arr); exit; $users = array(); $i = 1; if (empty($post_arr['reviews_per_paper'])) { @@ -822,11 +822,21 @@ function save_assignment_screen() //Get all papers // $papers=$this->get_papers_to_screen($papers_sources); $papers = $this->get_papers_to_screen($papers_sources, $paper_source_status); + if (isset($post_arr['assign_all_paper_checkbox']) && $post_arr['assign_all_paper_checkbox'] == 'off') { + $number_of_papers_to_assign = intval($post_arr['number_of_papers_to_assign']); + } else { + $number_of_papers_to_assign = count($papers['to_assign']); + } // print_test($papers); exit; $assign_papers = array(); $this->db2 = $this->load->database(project_db(), TRUE); $operation_code = active_user_id() . "_" . time(); + + $assigned_count = 0; foreach ($papers['to_assign'] as $key => $value) { + if ($assigned_count >= $number_of_papers_to_assign) { + break; + } $assign_papers[$key]['paper'] = $value['id']; $assign_papers[$key]['users'] = array(); $assignment_save = array( @@ -853,6 +863,7 @@ function save_assignment_screen() $this->db2->insert($table_name, $assignment_save); $j++; } + $assigned_count++; } $operation_arr = array( 'operation_code' => $operation_code, diff --git a/relis_app/controllers/test/Unit_test.php b/relis_app/controllers/test/Unit_test.php index 9aed9da6..39741a67 100755 --- a/relis_app/controllers/test/Unit_test.php +++ b/relis_app/controllers/test/Unit_test.php @@ -112,7 +112,7 @@ public function relis_unit_test($result = "html_report") $this->quality_assessmentUnitTest->run_tests(); $this->data_extractionUnitTest->run_tests(); $this->reportingUnitTest->run_tests(); - $this->elementUnitTest->run_tests(); + $this->elementUnitTest->run_tests(); $this->homeUnitTest->run_tests(); $this->installUnitTest->run_tests(); $this->adminUnitTest->run_tests(); diff --git a/relis_app/helpers/tests/data_extraction_ut_helper.php b/relis_app/helpers/tests/data_extraction_ut_helper.php index ebc1d00c..0bb63cd1 100755 --- a/relis_app/helpers/tests/data_extraction_ut_helper.php +++ b/relis_app/helpers/tests/data_extraction_ut_helper.php @@ -21,6 +21,7 @@ function run_tests() $this->deActivateClassification(); $this->displayAssignementForm(); $this->saveAssignmentclass_emptyUsers(); + $this->saveAssignment_3of5papers_2reviewers(); $this->saveAssignment_5papers_1reviewer(); $this->saveAssignment_6papers_3reviewers(); $this->saveAssignment_5papers_3reviewers(); @@ -210,6 +211,56 @@ private function saveAssignmentclass_emptyUsers() /* * Test 5 * Action : class_assignment_save + * Description : Test the number of assignment per reviewer with 3 out of 5 papers to assign to 2 reviewers. + * Expected Paper assignements : + * - The three assigned papers are added to the project database in the "assigned" table, one reviewer is assigned 1 papers and the other reviewer is assigned 2 papers. + * - assign_class operation inserted in operations table in the project DB + */ + private function saveAssignment_3of5papers_2reviewers() + { + $action = "class_assignment_save"; + $test_name = "Handle the saving of paper assignments for classification with 3 out of 5 papers to assign to 2 reviewers"; + $test_assignement = "Paper assignements"; + $expected_assignement = "Assigned"; + $actual_assignement = "Not assigned"; + + //initialise the Database + $this->TestInitialize(); + //add 5 papers to test Project + addBibtextPapersToProject("relis_app/helpers/tests/testFiles/paper/5_bibPapers.bib"); + //perform screening + assignPapers_and_performScreening([getAdminUserId()], 'Title'); + + $postData = ["number_of_users" => 2, "percentage" => 100, "user_1" => getAdminUserId(), "user_2" => getTestUserId(), "assign_all_paper_checkbox" => "off", "number_of_papers_to_assign" => 3]; + $response = $this->http_client->response($this->controller, $action, $postData, "POST"); + + if ($response['status_code'] >= 400) { + $actual_assignement = "" . $response['content'] . ""; + } else { + // Check the number of papers assigned to the first user + $nbrOfAssignment1 = $this->ci->db->query("SELECT COUNT(*) AS row_count FROM relis_dev_correct_" . getProjectShortName() . ".assigned WHERE assigned_user_id = " . getAdminUserId())->row_array()['row_count']; + + // Check the number of papers assigned to the second user + $nbrOfAssignment2 = $this->ci->db->query("SELECT COUNT(*) AS row_count FROM relis_dev_correct_" . getProjectShortName() . ".assigned WHERE assigned_user_id = " . getTestUserId())->row_array()['row_count']; + + //Check if the assign_class operation is inserted in operations table in the project DB + $operation = $this->ci->db->query("SELECT * FROM relis_dev_correct_" . getProjectShortName() . ".operations WHERE operation_type = 'assign_class' AND operation_desc = 'Assign papers for classification' AND operation_state = 'Active' AND operation_active = 1")->row_array(); + + if (abs($nbrOfAssignment1 - $nbrOfAssignment2) == 1 && !empty($operation)) { + $actual_assignement = "Assigned"; + } + } + + // Cleanup: Remove the papers assignment and operation records + $this->ci->db->query("DELETE FROM relis_dev_correct_" . getProjectShortName() . ".assigned WHERE assigned_user_id IN (" . getAdminUserId() . ", " . getTestUserId() . ")"); + $this->ci->db->query("DELETE FROM relis_dev_correct_" . getProjectShortName() . ".operations WHERE operation_type = 'assign_class' AND operation_desc = 'Assign papers for classification' AND operation_state = 'Active' AND operation_active = 1"); + + run_test($this->controller, $action, $test_name, $test_assignement, $expected_assignement, $actual_assignement); + } + + /* + * Test 6 + * Action : class_assignment_save * Description : Test the number of assignment per reviewer with 5 papers to assign to 1 reviewer. * Expected Paper assignements : * - The five assigned papers are added to the project database in the "assigned" table with the reviewer's user ID assigned to the "assigned_user_id" field for all five papers. @@ -245,7 +296,7 @@ private function saveAssignment_5papers_1reviewer() } /* - * Test 6 + * Test 7 * Action : class_assignment_save * Description : Test the number of assignment per reviewer with 6 papers to assign to 3 reviewers. * Expected Paper assignements : @@ -292,7 +343,7 @@ private function saveAssignment_6papers_3reviewers() } /* - * Test 7 + * Test 8 * Action : class_assignment_save * Description : Test the number of assignment per reviewer with 5 papers to assign to 3 reviewers. * Expected Paper assignements : @@ -344,7 +395,7 @@ private function saveAssignment_5papers_3reviewers() } /* - * Test 8 + * Test 9 * Action : class_assignment_save * Description : Test the number of assignment per reviewer with 5 papers to assign to 2 reviewers. * Expected Paper assignements : @@ -390,7 +441,7 @@ private function saveAssignment_5papers_2reviewers() } /* - * Test 9 + * Test 10 * Action : display_paper * Description : Display paper details to perform classification * Expected displayed paper @@ -426,7 +477,7 @@ private function displayPaper() } /* - * Test 10 + * Test 11 * Action : class_completion * Description : retrieves completion information for classification * Expected completion calculation @@ -462,7 +513,7 @@ private function class_completion_info() } /* - * Test 11 + * Test 12 * Action : list_classification * Description : display the list of all classifications done. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -485,7 +536,7 @@ private function listAllClassifications() } /* - * Test 12 + * Test 13 * Action : list_classification * Description : display the list of all classifications done in page 7. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -508,7 +559,7 @@ private function listAllClassifications_page7() } /* - * Test 13 + * Test 14 * Action : list_classification * Description : display the list of all classifications done with no dynamic table. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -531,7 +582,7 @@ private function listAllClassifications_noDynamicTable() } /* - * Test 14 + * Test 15 * Action : list_classification_dt * Description : display the list of all classifications done using Java script datatable. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -554,7 +605,7 @@ private function listAllClassifications_dt() } /* - * Test 15 + * Test 16 * Action : list_classification_dt * Description : display the list of all classifications done in page 7 using Java script datatable. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -577,7 +628,7 @@ private function listAllClassifications_page7_dt() } /* - * Test 16 + * Test 17 * Action : search_classification * Description : Search and display classification info with a string that matches 5 papers. * Expected displayed papers and number of displayed papers: 5 @@ -612,7 +663,7 @@ private function searchClassification_3matches() } /* - * Test 17 + * Test 18 * Action : search_classification * Description : Search and display classification info with a string that matches 1 paper. * Expected displayed paper(s) and number of displayed papers: 1 @@ -651,7 +702,7 @@ private function searchClassification_1match() } /* - * Test 18 + * Test 19 * Action : search_classification * Description : Search and display classification info with a string that matches 0 paper. * Expected displayed paper(s) and number of displayed papers: 0 @@ -687,7 +738,7 @@ private function searchClassification_0Match() } /* - * Test 19 + * Test 20 * Action : edit_classification * Description : Display the form to edit a classification. * Expected displayed correct form fields @@ -735,7 +786,7 @@ private function editClassification_normal() } /* - * Test 20 + * Test 21 * Action : edit_classification * Description : Display the form to edit a classification with modal view. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -758,7 +809,7 @@ private function editClassification_modal() } /* - * Test 21 + * Test 22 * Action : new_classification * Description : Display the form for a new classification. * Expected displayed correct form fields @@ -807,7 +858,7 @@ private function newClassification_normal() } /* - * Test 22 + * Test 23 * Action : new_classification_modal * Description : Display the form for a new classification in the modal view. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -830,7 +881,7 @@ private function newClassification_modal() } /* - * Test 23 + * Test 24 * Action : class_assignment_validation_set * Description : load the view to display the classification validation assignment form * Expected Number of users available for classification validation @@ -876,7 +927,7 @@ private function displayValidationAssignementForm() } /* - * Test 24 + * Test 25 * Action : class_validation_assignment_save * Description : Handle the saving of paper assignments for classification validation with empty percentage in POST request. * Expected Paper assignements : @@ -912,7 +963,7 @@ private function saveAssignmentValidation_noPercentage() } /* - * Test 25 + * Test 26 * Action : class_validation_assignment_save * Description : Handle the saving of paper assignments for classification validation with Wrong percentage (150%) in POST request. * Expected Paper assignements : @@ -948,7 +999,7 @@ private function saveAssignmentValidation_wrongPercentage() } /* - * Test 26 + * Test 27 * Action : class_validation_assignment_save * Description : Handle the saving of paper assignments for classification validation with empty users in POST request. * Expected Paper assignements : @@ -991,7 +1042,7 @@ private function saveAssignmentValidation_emptyUsers() } /* - * Test 27 + * Test 28 * Action : class_validation_assignment_save * Description : save the assignments of papers for classification validation with 30% of paper assignement. * Expected Paper assignements : @@ -1031,7 +1082,7 @@ private function saveAssignmentClassValidation_30percent() } /* - * Test 28 + * Test 29 * Action : class_validation_assignment_save * Description : save the assignments of papers for classification validation with 100% of paper assignement. * Expected Paper assignements : @@ -1087,7 +1138,7 @@ private function saveAssignmentClassValidation_100percent() } /* - * Test 29 + * Test 30 * Action : display_paper_validation * Description : Display paper details to perform classification validation * Expected displayed paper @@ -1124,7 +1175,7 @@ private function displayPaperValidation() } /* - * Test 30 + * Test 31 * Action : class_validate * Description : perform the validation of a classification for a specific paper as Correct QA. * Expected update in DB : In the assigned table, the validation field become "Correct" @@ -1149,7 +1200,7 @@ private function classValidate_setCcorrect() } /* - * Test 31 + * Test 32 * Action : class_validate * Description : perform the validation of a classification for a specific paper as not correct QA. * Expected update in DB : In the assigned table, the validation field become "Not Correct" @@ -1174,7 +1225,7 @@ private function classValidate_setNotCcorrect() } /* - * Test 32 + * Test 33 * Action : class_completion * Description : retrieves completion information for classification validation * Expected HTTP Response Code : 200 @@ -1198,7 +1249,7 @@ private function classValidation_completion_info() } /* - * Test 33 + * Test 34 * Action : remove_classification * Description : remove a classification entry for a project and redirect to data_extraction/display_paper * Expected removed classification: the class_active field in the classification table become 0 @@ -1223,7 +1274,7 @@ private function removeClassification() } /* - * Test 34 + * Test 35 * Action : remove_classification * Description : remove a classification entry for a project and redirect to paper/view_paper * Expected removed classification: the class_active field in the classification table become 0 diff --git a/relis_app/helpers/tests/helpers/functions_helper.php b/relis_app/helpers/tests/helpers/functions_helper.php index 9aeb1cc4..f3f4398d 100755 --- a/relis_app/helpers/tests/helpers/functions_helper.php +++ b/relis_app/helpers/tests/helpers/functions_helper.php @@ -636,10 +636,19 @@ function save_assignment_screen($data) $reviews_per_paper = $post_arr['reviews_per_paper']; //Get all papers $papers = get_papers_to_screen($papers_sources, $paper_source_status); + if (isset($post_arr['assign_all_paper_checkbox']) && $post_arr['assign_all_paper_checkbox'] == 'off') { + $number_of_papers_to_assign = intval($post_arr['number_of_papers_to_assign']); + } else { + $number_of_papers_to_assign = count($papers['to_assign']); + } $assign_papers = array(); $ci->db2 = $ci->load->database(project_db(), TRUE); $operation_code = active_user_id() . "_" . time(); + $assigned_count = 0; foreach ($papers['to_assign'] as $key => $value) { + if ($assigned_count >= $number_of_papers_to_assign) { + break; + } $assign_papers[$key]['paper'] = $value['id']; $assign_papers[$key]['users'] = array(); $assignment_save = array( @@ -666,6 +675,7 @@ function save_assignment_screen($data) $ci->db2->insert("relis_dev_correct_" . getProjectShortName() . "." . $table_name, $assignment_save); $j++; } + $assigned_count++; } $operation_arr = array( 'operation_code' => $operation_code, diff --git a/relis_app/helpers/tests/quality_assessment_ut_helper.php b/relis_app/helpers/tests/quality_assessment_ut_helper.php index 08a99bea..34e1311f 100755 --- a/relis_app/helpers/tests/quality_assessment_ut_helper.php +++ b/relis_app/helpers/tests/quality_assessment_ut_helper.php @@ -23,6 +23,7 @@ function run_tests() $this->deActivateQA(); $this->loadAssignmentView(); $this->saveAssignmentQA_emptyUsers(); + $this->saveAssignmentQA_2of5papers_2reviewers(); $this->saveAssignmentQA_4papers_1reviewer(); $this->saveAssignmentQA_6papers_3reviewers(); $this->saveAssignmentQA_5papers_3reviewers(); @@ -237,9 +238,55 @@ private function saveAssignmentQA_emptyUsers() run_test($this->controller, $action, $test_name, $test_assignement, $expected_assignement, $actual_assignement); } + /* * Test 5 * Action : qa_assignment_save + * Description : Test the number of assignment per reviewer with 2 out of 5 papers to assign to 2 reviewers. + * Expected Paper assignements : + * - The three assigned papers are added to the project database in the "qa_assignment" table, one reviewer is assigned 1 papers each. + * - assign_qa operation inserted in operations table in the project DB + */ + private function saveAssignmentQA_2of5papers_2reviewers() + { + $action = "qa_assignment_save"; + $test_name = "Test the number of assignment per reviewer with 2 out of 5 papers to assign to 2 reviewers"; + $test_assignement = "Paper assignements"; + $expected_assignement = "Assigned"; + $actual_assignement = "Not assigned"; + + //initialise the Database + $this->TestInitialize(); + //add 5 papers to test Project + addBibtextPapersToProject("relis_app/helpers/tests/testFiles/paper/5_bibPapers.bib"); + //perform screening + assignPapers_and_performScreening([getAdminUserId()], 'Title'); + + $postData = ["number_of_users" => 2, "percentage" => 100, "user_1" => getAdminUserId(), "user_2" => getTestUserId(), "assign_all_paper_checkbox" => "off", "number_of_papers_to_assign" => 2]; + $response = $this->http_client->response($this->controller, $action, $postData, "POST"); + + if ($response['status_code'] >= 400) { + $actual_assignement = "" . $response['content'] . ""; + } else { + // Check the number of papers assigned to the first user + $nbrOfAssignment1 = $this->ci->db->query("SELECT COUNT(*) AS row_count FROM relis_dev_correct_" . getProjectShortName() . ".qa_assignment WHERE assigned_to = " . getAdminUserId())->row_array()['row_count']; + // Check the number of papers assigned to the second user + $nbrOfAssignment2 = $this->ci->db->query("SELECT COUNT(*) AS row_count FROM relis_dev_correct_" . getProjectShortName() . ".qa_assignment WHERE assigned_to = " . getTestUserId())->row_array()['row_count']; + + //Check if the assign_qa operation is inserted in operations table in the project DB + $operation = $this->ci->db->query("SELECT * FROM relis_dev_correct_" . getProjectShortName() . ".operations WHERE operation_type = 'assign_qa' AND operation_desc = 'Assign papers for QA' AND operation_state = 'Active' AND operation_active = 1")->row_array(); + + if ($nbrOfAssignment1 == 1 && $nbrOfAssignment2 == 1 && !empty($operation)) { + $actual_assignement = "Assigned"; + } + + run_test($this->controller, $action, $test_name, $test_assignement, $expected_assignement, $actual_assignement); + } + } + + /* + * Test 6 + * Action : qa_assignment_save * Description : Test the number of assignment per reviewer with 4 papers to assign to 1 reviewer. * Expected Paper assignements : * - The four assigned papers are added to the project database in the "qa_assignment" table, with the reviewer's user ID assigned to the "assigned_to" field for all four papers. @@ -275,7 +322,7 @@ private function saveAssignmentQA_4papers_1reviewer() } /* - * Test 6 + * Test 7 * Action : qa_assignment_save * Description : Test the number of assignment per reviewer with 6 papers to assign to 3 reviewers. * Expected Paper assignements : @@ -324,7 +371,7 @@ private function saveAssignmentQA_6papers_3reviewers() } /* - * Test 7 + * Test 8 * Action : qa_assignment_save * Description : Test the number of assignment per reviewer with 5 papers to assign to 3 reviewers. * Expected Paper assignements : @@ -376,7 +423,7 @@ private function saveAssignmentQA_5papers_3reviewers() } /* - * Test 8 + * Test 9 * Action : qa_assignment_save * Description : Test the number of assignment per reviewer with 5 papers to assign to 2 reviewers. * Expected Paper assignements : @@ -421,7 +468,7 @@ private function saveAssignmentQA_5papers_2reviewers() } /* - * Test 9 + * Test 10 * Action : qa_conduct_list * Description : Display the list of all QA conduct results * Expected number of papers listed @@ -461,7 +508,7 @@ private function qaConductList_all() } /* - * Test 10 + * Test 11 * Action : qa_conduct_list * Description : display the list of pending QA conduct results * Expected number of papers listed @@ -492,7 +539,7 @@ private function qaConductList_pending() } /* - * Test 11 + * Test 12 * Action : qa_conduct_list * Description : display the list of done QA conduct results * Expected number of papers listed @@ -523,7 +570,7 @@ private function qaConductList_done() } /* - * Test 12 + * Test 13 * Action : qa_conduct_list * Description : display the list of excluded QA conduct results * Expected number of papers listed @@ -556,7 +603,7 @@ private function qaConductList_excluded() } /* - * Test 13 + * Test 14 * Action : qa_conduct_list * Description : display the list of a specific QA conduct results * Expected paper listed @@ -585,7 +632,7 @@ private function qaConductList_byId() /* * - * Test 14 + * Test 15 * Action : qa_conduct_save * Description : Edit the QA done for a paper * Expected database update: @@ -631,7 +678,7 @@ private function editQaForPaper() } /* - * Test 15 + * Test 16 * Action : qa_completion * Description : retrieves and display completion information for QA * Expected HTTP Response Code : 200 @@ -655,7 +702,7 @@ private function qa_completion_info() } /* - * Test 16 + * Test 17 * Action : qa_conduct_detail * Description : display the detailed information and results of a specific quality assessment (QA) conduct * Expected HTTP Response Code : 200 @@ -679,7 +726,7 @@ private function qaConductDetail() } /* - * Test 17 + * Test 18 * Action : qa_exlusion * Description : exclude a paper from quality assessment * Expected update in DB : In the paper table, the screening_status field become "Excluded_QA" and classification_status field become "Waiting" @@ -704,7 +751,7 @@ private function qaExlusion() } /* - * Test 18 + * Test 19 * Action : qa_exlusion * Description : cancel the exclusion of a paper from quality assessment * Expected update in DB : In the paper table, the screening_status field become "Included" and classification_status field become "To classify" @@ -729,7 +776,7 @@ private function qaCancelExlusion() } /* - * Test 19 + * Test 20 * Action : qa_conduct_save * Description : save the QA for a paper by answering all QA questions. * Expected QA score : 4.5 @@ -803,7 +850,7 @@ private function SaveQA_All_Questions() } /* - * Test 20 + * Test 21 * Action : qa_conduct_save * Description : save the QA for a paper by answering only one QA question. * Expected database update: @@ -866,7 +913,7 @@ private function SaveQA_1_Question() } /* - * Test 21 + * Test 22 * Action : qa_conduct_result * Description : display the overall result of all quality assessment (QA) conducts * Expected correct score for each QA assessment @@ -901,7 +948,7 @@ private function displayQaResult_all() } /* - * Test 22 + * Test 23 * Action : qa_conduct_result * Description : display the overall result of excluded quality assessment (QA) conducts * Expected HTTP Response Code : 200 @@ -927,7 +974,7 @@ private function displayQaResult_excluded() } /* - * Test 23 + * Test 24 * Action : qa_assignment_validation_set * Description : loads the form for assigning papers for quality assessment validation * Expected HTTP Response Code : 200 @@ -960,7 +1007,7 @@ private function loadAssignmentViewForValidation() } /* - * Test 24 + * Test 25 * Action : qa_validation_assignment_save * Description : Handle the saving of paper assignments for QA validation with empty percentage in POST request. * Expected Paper assignements : @@ -996,7 +1043,7 @@ private function saveAssignmentQAValidation_emptyPercentage() } /* - * Test 25 + * Test 26 * Action : qa_validation_assignment_save * Description : Handle the saving of paper assignments for QA validation with invalid percentage (>100) in POST request. * Expected Paper assignements : @@ -1032,7 +1079,7 @@ private function saveAssignmentQAValidation_invalidPercentage() } /* - * Test 26 + * Test 27 * Action : qa_validation_assignment_save * Description : Handle the saving of paper assignments for QA validation with empty users in POST request. * Expected Paper assignements : @@ -1068,7 +1115,7 @@ private function saveAssignmentQAValidation_emptyUsers() } /* - * Test 27 + * Test 28 * Action : qa_validation_assignment_save * Description : save the assignments of papers for quality assessment validation with 30% of paper assignement. * Expected Paper assignements : @@ -1112,7 +1159,7 @@ private function saveAssignmentQAValidation_30percent() } /* - * Test 28 + * Test 29 * Action : qa_validation_assignment_save * Description : save the assignments of papers for quality assessment validation with 100% of paper assignement. * Expected Paper assignements : @@ -1163,7 +1210,7 @@ private function saveAssignmentQAValidation_100percent() } /* - * Test 29 + * Test 30 * Action : qa_conduct_list_val * Description : display the list of all QA validation conduct results * Expected number of papers listed @@ -1206,7 +1253,7 @@ private function qaValidationConductList_all() } /* - * Test 30 + * Test 31 * Action : qa_conduct_list_val * Description : display the list of pending QA validation conduct results * Expected number of papers listed @@ -1237,7 +1284,7 @@ private function qaValidationConductList_pending() } /* - * Test 31 + * Test 32 * Action : qa_conduct_list_val * Description : display the list of done QA validation conduct results * Expected number of papers listed @@ -1268,7 +1315,7 @@ private function qaValidationConductList_done() } /* - * Test 32 + * Test 33 * Action : qa_conduct_list_val * Description : display the list of excluded QA validation conduct results * Expected number of papers listed @@ -1300,7 +1347,7 @@ private function qaValidationConductList_excluded() } /* - * Test 33 + * Test 34 * Action : qa_conduct_list_val * Description : display the list of a specific QA validation conduct results * Expected number of papers listed @@ -1329,7 +1376,7 @@ private function qaValidationConductList_byId() } /* - * Test 34 + * Test 35 * Action : qa_completion * Description : retrieves and display completion information for QA validation * Expected HTTP Response Code : 200 @@ -1353,7 +1400,7 @@ private function qaValidation_completion_info() } /* - * Test 35 + * Test 36 * Action : qa_exclude_low_quality * Description : exclude all papers with low quality * Expected update in DB : In the paper table, the screening_status field become "Excluded_QA" and classification_status field become "Waiting" @@ -1386,7 +1433,7 @@ private function qaExcludeLowQuality() } /* - * Test 36 + * Test 37 * Action : qa_validate * Description : perform the validation of a quality assessment for a specific paper as Correct QA. * Expected update in DB : In the qa_validation_assignment table, the validation field become "Correct" @@ -1415,7 +1462,7 @@ private function qaValidate_setCcorrect() } /* - * Test 37 + * Test 38 * Action : qa_validate * Description : perform the validation of a quality assessment for a specific paper as not correct QA. * Expected update in DB : In the qa_validation_assignment table, the validation field become "Not Correct" @@ -1440,7 +1487,7 @@ private function qaValidate_setNotCcorrect() } /* - * Test 38 + * Test 39 * Action : qa * Description : handles various aspects related to the QA perspective. * Expected HTTP Response Code : 200 diff --git a/relis_app/helpers/tests/screening_ut_helper.php b/relis_app/helpers/tests/screening_ut_helper.php index 2feb7e71..cda84f1d 100755 --- a/relis_app/helpers/tests/screening_ut_helper.php +++ b/relis_app/helpers/tests/screening_ut_helper.php @@ -28,6 +28,7 @@ function run_tests() $this->saveAssignmentScreen_withoutReviewsPerPaper(); $this->saveAssignmentScreen_ReviewPerPaper_moreThan_NbrOfUsers(); $this->saveAssignmentScreen_emptyUsers(); + $this->saveAssignment_3of5papers_1reviewer(); $this->saveAssignment_5papers_1reviewer(); $this->saveAssignment_6papers_3reviewers(); $this->saveAssignment_5papers_3reviewers(); @@ -525,7 +526,55 @@ private function saveAssignmentScreen_emptyUsers() } /* - * Test 12 + * Test 12 + * Action : save_assignment_screen + * Description : Test the number of assignment per reviewer with 3 out of 5 papers to assign to 1 reviewer. + * Expected Paper assignements : + * - The three assigned papers are added to the project database in the "screening_paper" table, with the reviewer's user ID assigned to the "user_id" field for all three papers. + * - assign_papers operation inserted in operations table in the project DB + */ + private function saveAssignment_3of5papers_1reviewer() + { + $action = "save_assignment_screen"; + $test_name = "Test the number of assignment per reviewer with 3 out of 5 papers to assign to 1 reviewer"; + + $test_assignement = "Paper assignements"; + $expected_assignement = "Assigned"; + + $userId = getAdminUserId(); //reviewer user ID + $postData = [ + "number_of_users" => 1, + "screening_phase" => getScreeningPhaseId("Title"), + "papers_sources" => "all", + "paper_source_status" => "all", + "user_1" => $userId, + "reviews_per_paper" => 1, + "assign_all_paper_checkbox" => "off", + "number_of_papers_to_assign" => 3 + ]; + + $response = $this->http_client->response($this->controller, $action, $postData, "POST"); + + if ($response['status_code'] >= 400) { + $actual_assignement = "" . $response['content'] . ""; + } else { + $actual_assignement = "Not assigned"; + + // Check if the three papers have been assigned to the only reviewer + $nbrOfAssignment = $this->ci->db->query("SELECT COUNT(*) AS row_count FROM relis_dev_correct_" . getProjectShortName() . ".screening_paper WHERE assignment_role = 'Screening' AND user_id = " . $userId)->row_array()['row_count']; + //Check if the assign_papers operation is inserted in operations table in the project DB + $operation = $this->ci->db->query("SELECT * FROM relis_dev_correct_" . getProjectShortName() . ".operations WHERE operation_type = 'assign_papers' AND operation_desc = 'Assign papers for screening' AND operation_state = 'Active' AND operation_active = 1")->row_array(); + + if ($nbrOfAssignment == 3 && !empty($operation)) { + $actual_assignement = "Assigned"; + } + } + + run_test($this->controller, $action, $test_name, $test_assignement, $expected_assignement, $actual_assignement); + } + + /* + * Test 13 * Action : save_assignment_screen * Description : Test the number of assignment per reviewer with 5 papers to assign to 1 reviewer. * Expected Paper assignements : @@ -572,7 +621,7 @@ private function saveAssignment_5papers_1reviewer() } /* - * Test 13 + * Test 14 * Action : save_assignment_screen * Description : Test the number of assignment per reviewer with 6 papers to assign to 3 reviewers. * Expected Paper assignements : @@ -633,7 +682,7 @@ private function saveAssignment_6papers_3reviewers() } /* - * Test 14 + * Test 15 * Action : save_assignment_screen * Description : Test the number of assignment per reviewer with 5 papers to assign to 3 reviewers. * Expected Paper assignements : @@ -697,7 +746,7 @@ private function saveAssignment_5papers_3reviewers() } /* - * Test 15 + * Test 16 * Action : save_assignment_screen * Description : Test the number of assignment per reviewer with 5 papers to assign to 2 reviewers. * Expected Paper assignements : @@ -753,7 +802,7 @@ private function saveAssignment_5papers_2reviewers() } /* - * Test 16 + * Test 17 * Action : save_screening * Description : Save the screening inclusion decision made for a paper with inclusion criteria field. * Expected screening details: check the screening decision of the screened paper @@ -779,7 +828,7 @@ private function saveScreening_InclusionField() } /* - * Test 17 + * Test 18 * Action : save_assignment_screen * Description : Test the number of assignment per reviewer with 5 papers to assign to 2 reviewers with 2 reviews per paper. * Expected Paper assignements : @@ -835,8 +884,10 @@ private function saveAssignment_5papers_2reviewers_2reviewsPerPaper() run_test($this->controller, $action, $test_name, $test_assignement, $expected_assignement, $actual_assignement); } + + /* - * Test 18 + * Test 19 * Action : screen_paper * Description : Handle the display of papers for screening. * Expected result: check if correct info is displayed. @@ -871,7 +922,7 @@ private function displayPapersForScreen() } /* - * Test 19 + * Test 20 * Action : edit_screen * Description : Handle the display of a paper for editing when screening hasn’t been done yet. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -897,7 +948,7 @@ private function displayPaperNotScreenedYet() } /* - * Test 20 + * Test 21 * Action : save_screening * Description : Save the screening exclusion decision made for a paper with no exclusion criteria field. * Expected screening details: No screening done @@ -924,7 +975,7 @@ private function saveScreening_noExcusionField() } /* - * Test 21 + * Test 22 * Action : screen_result * Description : Display screening statistics and results while no paper is screened yet. * Expected result: check if the results values are corrects @@ -975,7 +1026,7 @@ private function screenResult_noPaperScrenned() } /* - * Test 22 + * Test 23 * Action : screen_result * Description : Display screening statistics and results while 3 out of 5 papers are screened. * Expected result: check if the results values are corrects @@ -1025,7 +1076,7 @@ private function screenResult_3PapersScrenned() } /* - * Test 23 + * Test 24 * Action : save_screening * Description : Save the screening decision made for all papers. * Expected screening details @@ -1105,7 +1156,7 @@ private function saveScreeningAllPapers() } /* - * Test 24 + * Test 25 * Action : edit_screen * Description : Handle the display of a paper for editing a screening done. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -1131,7 +1182,7 @@ private function displayPaperForScreenEdit() } /* - * Test 25 + * Test 26 * Action : screen_completion * Description : calculate and display the completion progress of screening for users. * Expected correct completion progress calculation @@ -1164,7 +1215,7 @@ private function screenCompletion() } /* - * Test 26 + * Test 27 * Action : screen_result * Description : Display screening statistics and results with 1 paper Included, 2 excluded and 1 conflict. * Expected result: check if the results values are corrects @@ -1212,7 +1263,7 @@ private function screenResult_1Included_2excluded_1conflict() } /* - * Test 27 + * Test 28 * Action : save_phase_screen * Description : Handle the process of saving a screening phase without Title field. * Expected screening phase saved in DB: No phase should be inserted (Number of phases should be same before and after the request) @@ -1261,7 +1312,7 @@ private function savePhaseScreen_withoutTitleField() } /* - * Test 28 + * Test 29 * Action : save_phase_screen * Description : Handle the process of saving a screening phase without displayed_fields_vals field. * Expected screening phase saved in DB: No phase should be inserted (Number of phases should be same before and after the request) @@ -1309,7 +1360,7 @@ private function savePhaseScreen_withoutDisplayed_fields_valsField() } /* - * Test 29 + * Test 30 * Action : save_phase_screen * Description : Handle the process of saving a final screening phase while an final phase already exist. * Expected screening phase saved in DB: No phase should be inserted (Number of phases should be same before and after the request) @@ -1357,7 +1408,7 @@ private function savePhaseScreen_finalPhaseAlreadyExist() } /* - * Test 30 + * Test 31 * Action : save_phase_screen * Description : Handle the process of saving a screening phase. * Expected screening phase saved in DB. @@ -1416,7 +1467,7 @@ private function savePhaseScreen() } /* - * Test 31 + * Test 32 * Action : display_paper_screen * Description : Display the details of a paper in the screening process. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -1440,7 +1491,7 @@ private function displayPaperScreen() } /* - * Test 32 + * Test 33 * Action : list_screen * Description : display a list of screening done. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -1463,7 +1514,7 @@ private function listScreen() } /* - * Test 33 + * Test 34 * Action : validate_screen_set * Description : Display page for assigning papers for validation in the screening process. * Expected nbr of users (Number of users added to the project available for assignation) : 2 @@ -1537,7 +1588,7 @@ private function validateScreenSet() } /* - * Test 34 + * Test 35 * Action : save_assign_screen_validation * Description : Handle the saving of paper assignments for screening validation with empty percentage in POST request. * Expected Paper assignements : @@ -1582,7 +1633,7 @@ private function saveAssignmentValidation_emptyPercentage() } /* - * Test 35 + * Test 36 * Action : save_assign_screen_validation * Description : Handle the saving of paper assignments for screening validation with invalid percentage (>100) in POST request. * Expected Paper assignements : @@ -1627,7 +1678,7 @@ private function saveAssignmentValidation_invalidPercentage() } /* - * Test 36 + * Test 37 * Action : save_assign_screen_validation * Description : Handle the saving of paper assignments for screening validation with empty users in POST request. * Expected Paper assignements : @@ -1671,7 +1722,7 @@ private function saveAssignmentValidation_emptyUsers() } /* - * Test 37 + * Test 38 * Action : save_assign_screen_validation * Description : save the assignments of papers for screening validation with 50% of paper assignement. * Expected Paper assignements : @@ -1722,7 +1773,7 @@ private function saveAssignmentValidation_50percent() } /* - * Test 38 + * Test 39 * Action : save_assign_screen_validation * Description : save the assignments of papers for screening validation to whom have not screened them. * Expected Paper assignements : @@ -1882,7 +1933,7 @@ private function saveAssignmentValidation_assignToNotScreenedUser() } /* - * Test 39 + * Test 40 * Action : save_assign_screen_validation * Description : save the assignments of papers for screening validation with 100% of paper assignement. * Expected Paper assignements : @@ -1942,7 +1993,7 @@ private function saveAssignmentValidation_100percent() } /* - * Test 40 + * Test 41 * Action : save_assign_screen_validation * Description : save the assignments of papers for screening validation by exclusion criteria EC1 with 100%. * Expected Paper assignements : @@ -2004,7 +2055,7 @@ private function saveAssignmentValidation_by1criteria() } /* - * Test 41 + * Test 42 * Action : screen_paper_validation * Description : handle the display of a paper for screening validation * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -2031,7 +2082,7 @@ private function screenPaperValidation() } /* - * Test 42 + * Test 43 * Action : screen_completion * Description : calculate and display the completion progress of screening validation for users. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -2058,7 +2109,7 @@ private function screenValidationCompletion() } /* - * Test 43 + * Test 44 * Action : screen_validation_result * Description : Display screening validation statistics and results. * Expected HTTP Response Code : 200 OK (indicating a successful response from the server). @@ -2085,7 +2136,7 @@ private function screenValidationResult() } /* - * Test 44 + * Test 45 * Action : remove_screening * Description : Remove a screening entry from the database. * Expected update in DB @@ -2115,7 +2166,7 @@ private function removeScreening() } /* - * Test 45 + * Test 46 * Action : remove_screening_validation * Description : Handle the removal of screening validation entries from the database. * Expected update in DB @@ -2145,7 +2196,7 @@ private function removeScreeningValidation() } /* - * Test 46 + * Test 47 * Action : screening * Description : Display screening home page with 4 papers screened. * Expected result: check if displayed data is correct @@ -2176,7 +2227,7 @@ private function screening_4papersScreened() } /* - * Test 47 + * Test 48 * Action : screening * Description : Display screening home page with 0 paper screened. * Expected result: check if displayed data is correct diff --git a/relis_app/views/data_extraction/assign_papers_class.php b/relis_app/views/data_extraction/assign_papers_class.php index ff6cb8a1..fb1cf168 100755 --- a/relis_app/views/data_extraction/assign_papers_class.php +++ b/relis_app/views/data_extraction/assign_papers_class.php @@ -64,8 +64,25 @@ echo checkbox_form_bm($user_name,'user_'.$i,'user_'.$user_id,$user_id); $i++; } - - + + echo "
"; + + $label = "Assign all papers"; + $name = 'assign_all_paper_checkbox'; + $id = 'assign_all_paper_checkbox'; + echo '
'; + echo form_label($label, $name, array('class' => 'control-label col-md-3 col-sm-3 col-xs-12')); + echo '
'; + echo ''; + echo '
'; + + echo ''; ?> @@ -111,4 +128,16 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/relis_app/views/quality_assessment/assign_papers_qa.php b/relis_app/views/quality_assessment/assign_papers_qa.php index c1d9b3f4..47d11b70 100755 --- a/relis_app/views/quality_assessment/assign_papers_qa.php +++ b/relis_app/views/quality_assessment/assign_papers_qa.php @@ -64,8 +64,25 @@ echo checkbox_form_bm($user_name,'user_'.$i,'user_'.$user_id,$user_id); $i++; } - - + + echo "
"; + + $label = "Assign all papers"; + $name = 'assign_all_paper_checkbox'; + $id = 'assign_all_paper_checkbox'; + echo '
'; + echo form_label($label, $name, array('class' => 'control-label col-md-3 col-sm-3 col-xs-12')); + echo '
'; + echo ''; + echo '
'; + + echo ''; ?> @@ -111,4 +128,16 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/relis_app/views/screening/assign_papers_screen_auto.php b/relis_app/views/screening/assign_papers_screen_auto.php index e3091385..ed4c50b0 100755 --- a/relis_app/views/screening/assign_papers_screen_auto.php +++ b/relis_app/views/screening/assign_papers_screen_auto.php @@ -75,6 +75,25 @@ echo input_form_bm(lng('Reviews per paper'), 'reviews_per_paper', 'reviews_per_paper', $reviews_per_paper); + echo "
"; + + $label = "Assign all papers"; + $name = 'assign_all_paper_checkbox'; + $id = 'assign_all_paper_checkbox'; + echo '
'; + echo form_label($label, $name, array('class' => 'control-label col-md-3 col-sm-3 col-xs-12')); + echo '
'; + echo ''; + echo '
'; + + echo ''; + ?>
@@ -120,4 +139,16 @@ - \ No newline at end of file + + + \ No newline at end of file