Page MenuHomePhabricator

Calendar query results should be ordered from first start date to last start date
ClosedPublic

Authored by lpriestley on May 21 2015, 5:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 1:40 AM
Unknown Object (File)
Tue, Apr 16, 2:58 AM
Unknown Object (File)
Thu, Apr 11, 9:28 AM
Unknown Object (File)
Mon, Apr 1, 3:04 AM
Unknown Object (File)
Mar 20 2024, 3:04 PM
Unknown Object (File)
Feb 27 2024, 7:11 PM
Unknown Object (File)
Feb 27 2024, 7:11 PM
Unknown Object (File)
Feb 27 2024, 7:11 PM
Subscribers

Details

Summary

Closes T8041, Calendar query results should be ordered from first start date to last start date

Test Plan

Open "Upcoming Events" in Calendar, verify that the event with the first start date is first and that events are ordered in ascending start dates.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lpriestley retitled this revision from to Calendar query results should be ordered from first start date to last start date.
lpriestley updated this object.
lpriestley edited the test plan for this revision. (Show Details)
lpriestley added a reviewer: epriestley.
epriestley edited edge metadata.
epriestley added inline comments.
src/applications/calendar/query/PhabricatorCalendarEventQuery.php
46

(3) After you remove 'unique' => true, you'll have to change this to array('start', 'id'); or it will complain that the order vector does not have a terminal unique column.

55

(1) This should be 'int'.

56

(2) This isn't unique, since two events can have the same exact start value.

Labeling a non-unique column as unique will create problems when the edge of a page has objects with the same value on either side of it. For example, if the end of the first page has several events which start on May 3 at 12:00 AM, and the beginning of the second page also has several events which start on May 3 at 12:00 AM, the code will believe that it can exclude all of them (because it thinks the value is unique). It will generate a query like AND dateFrom > "May 3 at 12:00 AM" and skip all of the results on the second page.

58

(4) After you change the vector to array('start', 'id'), you'll get an error about 'id' not being defined as an orderable column. You can fix that by including the 'id' definition from the parent class with + parent::getOrderableColumns().

63–64

(5) Finally, after making 'id' an orderable column, this will complain that the paging value map does not include a value for 'id'. Add 'id' => $event->getID() here to fix that. Then everything should work.

This revision now requires changes to proceed.May 21 2015, 5:51 PM
lpriestley edited edge metadata.
lpriestley marked 5 inline comments as done.

Fixing implementation of orderableColumns

epriestley edited edge metadata.
This revision is now accepted and ready to land.May 21 2015, 10:54 PM
This revision was automatically updated to reflect the committed changes.