Changeset fe9d1e2 in iPeer


Ignore:
Timestamp:
2013-08-07T16:08:20-07:00 (4 years ago)
Author:
Compass <pan.luo@…>
Branches:
3.1.x, dev, master
Children:
76b2eec
Parents:
cdb0e4a
git-author:
mwytang <michael.tang@…> (08/06/2013 02:44:05 PM)
git-committer:
Compass <pan.luo@…> (08/07/2013 04:08:20 PM)
Message:

Fixed reported bug in student index

The bug is events that are not released (release dates are in the
future) are placed in the expired section, when they should not be
displayed at all. The reason behind the bug is events in the above
situation are fulfills one of the filters requirements (no submissions
and date is before result_release_date_end.

To fix this bug I have added an extra condition which is the current
date and time has to also be after release_date_end for the event
to be placed in the expired section.

I have added an extra event to test this bug. The event is set to
be released "next" year on July 31st. Using the existing tests, we
can check that the bug is permanently fixed. The new event should not
appear in the expired array or any other events' arrays.

Location:
app
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • app/config/sql/ipeer_samples_data.sql

    rcdb0e4a rfe9d1e2  
    334334
    335335INSERT INTO `email_schedules` (`id`, `subject`, `content`, `date`, `from`, `to`, `course_id`, `event_id`, `grp_id`, `sent`, `creator_id`, `created`) VALUES
    336 (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'),
     336(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'),
    337337(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'),
    338338(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');
     
    699699(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'),
    700700(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'),
    701 (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');
     701(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'),
     702(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');
    702703
    703704-- --------------------------------------------------------
     
    740741INSERT INTO `group_events` VALUES (10, 1, 8, 'not reviewed', NULL, 'None', 'None', 'A', 0, '0000-00-00 00:00:00', NULL, NULL);
    741742INSERT INTO `group_events` VALUES (11, 1, 9, 'not reviewed', NULL, 'None', 'None', 'A', 0, '0000-00-00 00:00:00', NULL, NULL);
     743INSERT INTO `group_events` VALUES (12, 1, 10, 'not reviewed', NULL, 'None', 'None', 'A', 0, '0000-00-00 00:00:00', NULL, NULL);
     744
    742745-- --------------------------------------------------------
    743746
  • app/controllers/home_controller.php

    rcdb0e4a rfe9d1e2  
    181181            else if (empty($event['EvaluationSubmission']) &&
    182182                strtotime('NOW') <
    183                 strtotime($event['Event']['result_release_date_end'])
     183                strtotime($event['Event']['result_release_date_end']) &&
     184                strtotime('NOW') >
     185                strtotime($event['Event']['release_date_end'])
    184186            ) { // student did not do the survey within the allowed time
    185187                // but we should still let them view results
  • app/tests/cases/controllers/courses_controller.test.php

    rcdb0e4a rfe9d1e2  
    339339        $this->assertEqual($result['data']['Course']['title'], $this->fixtureView['Course'][0]['title']);
    340340        $this->assertEqual($result['groupCount'], 2);
    341         $this->assertEqual($result['eventCount'], 9);
     341        $this->assertEqual($result['eventCount'], 10);
    342342        $this->assertEqual($result['title_for_layout'], $this->fixtureView['Course'][0]['course'].' - '.$this->fixtureView['Course'][0]['title']);
    343343    }
  • app/tests/cases/controllers/events_controller.test.php

    rcdb0e4a rfe9d1e2  
    8484
    8585        $this->assertEqual(count($result["paramsForList"]['data']['entries']),
    86             9);
     86            10);
    8787        $this->assertEqual(sort(Set::extract($result["paramsForList"]['data']['entries'], '/Event/id')), array(1,2,3,6));
    8888        $events = Set::sort($result["paramsForList"]['data']['entries'], '{n}.Event.id', 'asc');
  • app/tests/cases/controllers/home_controller.test.php

    rcdb0e4a rfe9d1e2  
    8282        $inactiveCourses = $result['course_list']['I'];
    8383        $this->assertEqual(count($activeCourses[0]['Instructor']), 1);
    84         $this->assertEqual(count($activeCourses[0]['Event']), 9);
     84        $this->assertEqual(count($activeCourses[0]['Event']), 10);
    8585        $this->assertEqual(count($activeCourses[1]['Instructor']), 2);
    8686        $this->assertEqual(count($activeCourses[1]['Event']), 0);
     
    102102        $activeCourses = $result['course_list']['A'];
    103103        $this->assertEqual(count($activeCourses[0]['Instructor']), 1);
    104         $this->assertEqual(count($activeCourses[0]['Event']), 9);
     104        $this->assertEqual(count($activeCourses[0]['Event']), 10);
    105105    }
    106106
  • app/tests/cases/models/event.test.php

    rcdb0e4a rfe9d1e2  
    9090        //Test a valid course number
    9191        $course = $this->Event->getCourseEventCount(1);
    92         $this->assertEqual($course, 9);
     92        $this->assertEqual($course, 10);
    9393
    9494        //Test an invalid course number
     
    280280        $events = $this->Event->getEventsByUserId(5);
    281281        $evaluations = $events['Evaluations'];
    282         $this->assertEqual(count($evaluations), 7);
     282        $this->assertEqual(count($evaluations), 8);
    283283        $surveys = $events['Surveys'];
    284284        $this->assertEqual(count($surveys), 2);
     
    294294        $events = $this->Event->getEventsByUserId(5, array('id', 'title'));
    295295        $evaluations = $events['Evaluations'];
    296         $this->assertEqual(count($evaluations), 7);
     296        $this->assertEqual(count($evaluations), 8);
    297297        $surveys = $events['Surveys'];
    298298        $this->assertEqual(count($surveys), 2);
     
    301301        $events = $this->Event->getEventsByUserId(7);
    302302        $evaluations = $events['Evaluations'];
    303         $this->assertEqual(count($evaluations), 11);
     303        $this->assertEqual(count($evaluations), 12);
    304304        $surveys = $events['Surveys'];
    305305        $this->assertEqual(count($surveys), 2);
Note: See TracChangeset for help on using the changeset viewer.