diff --git a/app/config/sql/ipeer_samples_data.sql b/app/config/sql/ipeer_samples_data.sql index e7827d5cf..784ab4b2d 100644 --- a/app/config/sql/ipeer_samples_data.sql +++ b/app/config/sql/ipeer_samples_data.sql @@ -2027,7 +2027,7 @@ INSERT INTO `sys_parameters` (`parameter_code`, `parameter_value`, `parameter_ty ('system.super_admin', 'root', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), ('system.admin_email', 'Please enter the iPeer administrator\\''s email address.', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), ('display.date_format', 'D, M j, Y g:i a', 'S', 'date format preference', 'A', 0, NOW(), NULL, NOW()), -('system.version', '3.1.3', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), +('system.version', '3.1.4', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), ('database.version', '7', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()), ('email.port', '25', 'S', 'port number for email smtp option', 'A', '0', NOW(), NULL , NOW()), ('email.host', 'localhost', 'S', 'host address for email smtp option', 'A', '0', NOW(), NULL , NOW()), diff --git a/app/controllers/events_controller.php b/app/controllers/events_controller.php index e597b0a67..f7fa1429a 100644 --- a/app/controllers/events_controller.php +++ b/app/controllers/events_controller.php @@ -85,7 +85,7 @@ function postProcessData($data) } else { $entry['!Custom']['resultReleased'] = 'Manual'; } - + // group count if ($entry['Event']['event_template_type_id'] == 3) { $entry['!Custom']['group_count'] = 'N/A'; @@ -375,9 +375,9 @@ function add($courseId) //Call the setSchedule function to Schedule reminder emails $this->setSchedule($this->Event->id, $this->data); // set release status for group event - $groupEvents = $this->GroupEvent->find('list', + $groupEvents = $this->GroupEvent->find('list', array('conditions' => array('event_id'=>$this->Event->id))); - if ($this->data['Event']['auto_release']) { + if (isset($this->data['Event']['auto_release']) && $this->data['Event']['auto_release']) { $this->Evaluation->setGroupEventsReleaseStatus($groupEvents, 'Auto'); } else { $this->Evaluation->setGroupEventsReleaseStatus($groupEvents, 'None'); @@ -483,7 +483,7 @@ function edit($eventId) $this->redirect('index'); return; } - + $orig_email_frequency = $this->calculateFrequency($eventId); $this->set('email_schedule', $orig_email_frequency); $emailTemp = $this->EmailSchedule->find('first', array( @@ -512,14 +512,14 @@ function edit($eventId) $this->data['Event']['template_id'] = $this->data['Event']['Mixeval']; } - + // if all groups unselected - delete groupEvents if (empty($this->data['Group']['Group'])) { $this->GroupEvent->deleteAll(array('GroupEvent.event_id' => $eventId)); } - + // update submitted evaluations release status if auto-release status has been changed - $groupEvents = $this->GroupEvent->find('list', + $groupEvents = $this->GroupEvent->find('list', array('conditions' => array('event_id'=>$eventId))); if ($this->data['Event']['auto_release'] != $event['Event']['auto_release']) { $model = null; @@ -538,7 +538,7 @@ function edit($eventId) $this->EvaluationMixeval->setAllEventGradeRelease($eventId, $this->data['Event']['auto_release']); break; } - + if ($this->data['Event']['auto_release']) { $this->Evaluation->setGroupEventsReleaseStatus($groupEvents, 'Auto'); } else { diff --git a/app/tests/cases/controllers/faculties_controller.test.php b/app/tests/cases/controllers/faculties_controller.test.php index a6aebe102..4bfedf3d5 100644 --- a/app/tests/cases/controllers/faculties_controller.test.php +++ b/app/tests/cases/controllers/faculties_controller.test.php @@ -74,32 +74,50 @@ function testIndex() { } function testView() { + $departments = array ( + array ( + 'id' => '1', + 'Name' => 'MECH', + ), + array ( + 'id' => '2', + 'Name' => 'APSC', + ), + ); + $userfaculty =array ( + array ( + 'id' => '2', + 'Username' => 'instructor1', + 'Full Name' => 'Instructor 1', + 'Email' => 'instructor1@email', + 'Role' => 'instructor', + ), + array ( + 'id' => '3', + 'Username' => 'instructor2', + 'Full Name' => 'Instructor 2', + 'Email' => '', + 'Role' => 'instructor', + ), + array ( + 'id' => '4', + 'Username' => 'instructor3', + 'Full Name' => 'Instructor 3', + 'Email' => '', + 'Role' => 'instructor', + ), + array ( + 'id' => '34', + 'Username' => 'admin1', + 'Full Name' => 'admin1', + 'Email' => '', + 'Role' => 'admin', + ), + ); $return = $this->testAction('/faculties/view/1', array('return' => 'vars')); $this->assertEqual($return['faculty'], 'Applied Science'); - $this->assertEqual($return['departments'][0]['id'], 1); - $this->assertEqual($return['departments'][0]['Name'], 'MECH'); - $this->assertEqual($return['departments'][1]['id'], 2); - $this->assertEqual($return['departments'][1]['Name'], 'APSC'); - $this->assertEqual($return['userfaculty'][1]['id'], 2); - $this->assertEqual($return['userfaculty'][1]['Username'], 'instructor1'); - $this->assertEqual($return['userfaculty'][1]['Full Name'], 'Instructor 1'); - $this->assertEqual($return['userfaculty'][1]['Email'], 'instructor1@email'); - $this->assertEqual($return['userfaculty'][1]['Role'], 'instructor'); - $this->assertEqual($return['userfaculty'][2]['id'], 3); - $this->assertEqual($return['userfaculty'][2]['Username'], 'instructor2'); - $this->assertEqual($return['userfaculty'][2]['Full Name'], 'Instructor 2'); - $this->assertEqual($return['userfaculty'][2]['Email'], ''); - $this->assertEqual($return['userfaculty'][2]['Role'], 'instructor'); - $this->assertEqual($return['userfaculty'][3]['id'], 4); - $this->assertEqual($return['userfaculty'][3]['Username'], 'instructor3'); - $this->assertEqual($return['userfaculty'][3]['Full Name'], 'Instructor 3'); - $this->assertEqual($return['userfaculty'][3]['Email'], ''); - $this->assertEqual($return['userfaculty'][3]['Role'], 'instructor'); - $this->assertEqual($return['userfaculty'][4]['id'], 34); - $this->assertEqual($return['userfaculty'][4]['Username'], 'admin1'); - $this->assertEqual($return['userfaculty'][4]['Full Name'], 'admin1'); - $this->assertEqual($return['userfaculty'][4]['Email'], ''); - $this->assertEqual($return['userfaculty'][4]['Role'], 'admin'); + $this->assertEqual($return['departments'], $departments); + $this->assertEqual($return['userfaculty'], $userfaculty); } function testAdd() { @@ -107,7 +125,7 @@ function testAdd() { } function testEdit() { - + } function testDelete() {