diff --git a/app/config/sql/ipeer_samples_data.sql b/app/config/sql/ipeer_samples_data.sql index 2f7c49c9d..cc3ee4d47 100644 --- a/app/config/sql/ipeer_samples_data.sql +++ b/app/config/sql/ipeer_samples_data.sql @@ -333,7 +333,7 @@ CREATE TABLE IF NOT EXISTS `email_schedules` ( -- INSERT INTO `email_schedules` (`id`, `subject`, `content`, `date`, `from`, `to`, `course_id`, `event_id`, `grp_id`, `sent`, `creator_id`, `created`) VALUES -(1, 'Email Template', 'Hello, {{{FIRSTNAME}}}', '2013-07-18 16:52:31', '1', '5;6;7;13;15;17;19;21;26;28;31;32;33', NULL, NULL, NULL, 0, 1, '2012-07-16 16:52:50'), +(1, 'Email Template', 'Hello, {{{FIRSTNAME}}}', CONCAT(YEAR(DATE_ADD(NOW(), INTERVAL 1 YEAR)), '-07-18 16:52:31'), '1', '5;6;7;13;15;17;19;21;26;28;31;32;33', NULL, NULL, NULL, 0, 1, '2012-07-16 16:52:50'), (2, 'Email Template', 'Hello, {{{USERNAME}}}', '2011-07-18 16:52:31', '1', '5;6;7;13;15;17;19;21;26;28;31;32;33', NULL, NULL, NULL, 0, 1, '2010-07-16 16:57:50'), (3, 'Email Template', 'Hi, {{{USERNAME}}}', '2011-07-18 17:52:31', '1', '5;6;7;13;15;17;19;21;26;28;31;32;33', NULL, NULL, NULL, 1, 1, '2010-07-16 16:57:50'); @@ -698,7 +698,8 @@ INSERT INTO events (id, title, course_id, description, event_template_type_id, t (6, 'simple evaluation 2', 1, '2nd simple evaluation', 1, 1, '0', 0, '2012-11-28 00:00:00', '2012-11-20 00:00:00', '2022-11-29 00:00:00', '2022-11-30 00:00:00', '2022-12-12 00:00:00', 'A', 1, '2012-11-21 12:23:13', 1, '2012-11-21 12:23:13'), (7, 'simple evaluation 3', 1, '3rd simple evaluation for testing overdue event', 1, 1, '0', 0, '2012-11-28 00:00:00', '2012-11-20 00:00:00', '2012-11-29 00:00:00', '2022-11-30 00:00:00', '2022-12-12 00:00:00', 'A', 1, '2012-11-21 12:23:13', 1, '2012-11-21 12:23:13'), (8, 'simple evaluation 4', 1, 'result released with submission', 1, 1, '0', 0, '2012-11-28 00:00:00', '2012-11-20 00:00:00', '2012-11-29 00:00:00', '2012-11-30 00:00:00', '2022-12-12 00:00:00', 'A', 1, '2012-11-21 12:23:13', 1, '2012-11-21 12:23:13'), -(9, 'simple evaluation 5', 1, 'result released with no submission', 1, 1, '0', 0, '2012-11-28 00:00:00', '2012-11-20 00:00:00', '2012-11-29 00:00:00', '2012-11-30 00:00:00', '2022-12-12 00:00:00', 'A', 1, '2012-11-21 12:23:13', 1, '2012-11-21 12:23:13'); +(9, 'simple evaluation 5', 1, 'result released with no submission', 1, 1, '0', 0, '2012-11-28 00:00:00', '2012-11-20 00:00:00', '2012-11-29 00:00:00', '2012-11-30 00:00:00', '2022-12-12 00:00:00', 'A', 1, '2012-11-21 12:23:13', 1, '2012-11-21 12:23:13'), +(10, 'simple evaluation 6', 1, 'result released with no submission', 1, 1, '0', 0, CONCAT(YEAR(DATE_ADD(NOW(), INTERVAL 2 YEAR)), '-07-31 11:20:00'), CONCAT(YEAR(DATE_ADD(NOW(), INTERVAL 1 YEAR)), '-07-31 11:20:00'), CONCAT(YEAR(DATE_ADD(NOW(), INTERVAL 2 YEAR)), '-07-31 11:20:00'), CONCAT(YEAR(DATE_ADD(NOW(), INTERVAL 2 YEAR)), '-07-31 11:20:00'), CONCAT(YEAR(DATE_ADD(NOW(), INTERVAL 3 YEAR)), '-07-31 11:20:00'), 'A', 1, '2012-11-21 12:23:13', 1, '2012-11-21 12:23:13'); -- -------------------------------------------------------- @@ -739,6 +740,8 @@ INSERT INTO `group_events` VALUES (8, 2, 6, 'not reviewed', NULL, 'None', 'None' INSERT INTO `group_events` VALUES (9, 1, 7, 'not reviewed', NULL, 'None', 'None', 'A', 0, '0000-00-00 00:00:00', NULL, NULL); INSERT INTO `group_events` VALUES (10, 1, 8, 'not reviewed', NULL, 'None', 'None', 'A', 0, '0000-00-00 00:00:00', NULL, NULL); INSERT INTO `group_events` VALUES (11, 1, 9, 'not reviewed', NULL, 'None', 'None', 'A', 0, '0000-00-00 00:00:00', NULL, NULL); +INSERT INTO `group_events` VALUES (12, 1, 10, 'not reviewed', NULL, 'None', 'None', 'A', 0, '0000-00-00 00:00:00', NULL, NULL); + -- -------------------------------------------------------- -- diff --git a/app/controllers/home_controller.php b/app/controllers/home_controller.php index 6f61a4db4..c70033dc0 100644 --- a/app/controllers/home_controller.php +++ b/app/controllers/home_controller.php @@ -180,7 +180,9 @@ private function _splitSubmittedEvents($events) } else if (empty($event['EvaluationSubmission']) && strtotime('NOW') < - strtotime($event['Event']['result_release_date_end']) + strtotime($event['Event']['result_release_date_end']) && + strtotime('NOW') > + strtotime($event['Event']['release_date_end']) ) { // student did not do the survey within the allowed time // but we should still let them view results $expired[] = $event; diff --git a/app/tests/cases/controllers/courses_controller.test.php b/app/tests/cases/controllers/courses_controller.test.php index 66a277d11..040598a54 100644 --- a/app/tests/cases/controllers/courses_controller.test.php +++ b/app/tests/cases/controllers/courses_controller.test.php @@ -338,7 +338,7 @@ function testHome() $this->assertEqual($result['data']['Course']['course'], $this->fixtureView['Course'][0]['course']); $this->assertEqual($result['data']['Course']['title'], $this->fixtureView['Course'][0]['title']); $this->assertEqual($result['groupCount'], 2); - $this->assertEqual($result['eventCount'], 9); + $this->assertEqual($result['eventCount'], 10); $this->assertEqual($result['title_for_layout'], $this->fixtureView['Course'][0]['course'].' - '.$this->fixtureView['Course'][0]['title']); } diff --git a/app/tests/cases/controllers/events_controller.test.php b/app/tests/cases/controllers/events_controller.test.php index e453a1f32..6bf782146 100644 --- a/app/tests/cases/controllers/events_controller.test.php +++ b/app/tests/cases/controllers/events_controller.test.php @@ -83,7 +83,7 @@ function testIndex() { $result = $this->testAction('/events/index', array('return' => 'vars')); $this->assertEqual(count($result["paramsForList"]['data']['entries']), - 9); + 10); $this->assertEqual(sort(Set::extract($result["paramsForList"]['data']['entries'], '/Event/id')), array(1,2,3,6)); $events = Set::sort($result["paramsForList"]['data']['entries'], '{n}.Event.id', 'asc'); $this->assertEqual($events[0]['Event']['Title'], 'Term 1 Evaluation'); diff --git a/app/tests/cases/controllers/home_controller.test.php b/app/tests/cases/controllers/home_controller.test.php index 0b98a59c7..ed5756ff4 100644 --- a/app/tests/cases/controllers/home_controller.test.php +++ b/app/tests/cases/controllers/home_controller.test.php @@ -81,7 +81,7 @@ function testIndex() $activeCourses = Set::sort($result['course_list']['A'], '{n}.Course.id', 'asc'); $inactiveCourses = $result['course_list']['I']; $this->assertEqual(count($activeCourses[0]['Instructor']), 1); - $this->assertEqual(count($activeCourses[0]['Event']), 9); + $this->assertEqual(count($activeCourses[0]['Event']), 10); $this->assertEqual(count($activeCourses[1]['Instructor']), 2); $this->assertEqual(count($activeCourses[1]['Event']), 0); $this->assertEqual(count($inactiveCourses[0]['Instructor']), 1); @@ -101,7 +101,7 @@ function testIndexInstructor() $this->assertFalse(isset($result['course_list']['I'])); $activeCourses = $result['course_list']['A']; $this->assertEqual(count($activeCourses[0]['Instructor']), 1); - $this->assertEqual(count($activeCourses[0]['Event']), 9); + $this->assertEqual(count($activeCourses[0]['Event']), 10); } function testIndexStudent() diff --git a/app/tests/cases/models/event.test.php b/app/tests/cases/models/event.test.php index e9332695a..cac2b3daf 100644 --- a/app/tests/cases/models/event.test.php +++ b/app/tests/cases/models/event.test.php @@ -89,7 +89,7 @@ function testGetCourseEventCount() //Test a valid course number $course = $this->Event->getCourseEventCount(1); - $this->assertEqual($course, 9); + $this->assertEqual($course, 10); //Test an invalid course number $course = $this->Event->getCourseEventCount(999); @@ -279,7 +279,7 @@ function testGetEventsByUserId() // normal student $events = $this->Event->getEventsByUserId(5); $evaluations = $events['Evaluations']; - $this->assertEqual(count($evaluations), 7); + $this->assertEqual(count($evaluations), 8); $surveys = $events['Surveys']; $this->assertEqual(count($surveys), 2); @@ -293,14 +293,14 @@ function testGetEventsByUserId() // normal student with fields $events = $this->Event->getEventsByUserId(5, array('id', 'title')); $evaluations = $events['Evaluations']; - $this->assertEqual(count($evaluations), 7); + $this->assertEqual(count($evaluations), 8); $surveys = $events['Surveys']; $this->assertEqual(count($surveys), 2); // student within two groups in the same event $events = $this->Event->getEventsByUserId(7); $evaluations = $events['Evaluations']; - $this->assertEqual(count($evaluations), 11); + $this->assertEqual(count($evaluations), 12); $surveys = $events['Surveys']; $this->assertEqual(count($surveys), 2); }