Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13955204
D10223.id24590.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D10223.id24590.diff
View Options
diff --git a/src/applications/phrequent/query/PhrequentSearchEngine.php b/src/applications/phrequent/query/PhrequentSearchEngine.php
--- a/src/applications/phrequent/query/PhrequentSearchEngine.php
+++ b/src/applications/phrequent/query/PhrequentSearchEngine.php
@@ -29,7 +29,8 @@
}
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
- $query = id(new PhrequentUserTimeQuery());
+ $query = id(new PhrequentUserTimeQuery())
+ ->needPreemptingEvents(true);
$user_phids = $saved->getParameter('userPHIDs');
if ($user_phids) {
@@ -136,7 +137,6 @@
foreach ($usertimes as $usertime) {
$item = new PHUIObjectItemView();
-
if ($usertime->getObjectPHID() === null) {
$item->setHeader($usertime->getNote());
} else {
@@ -154,12 +154,10 @@
$started_date = phabricator_date($usertime->getDateStarted(), $viewer);
$item->addIcon('none', $started_date);
- if ($usertime->getDateEnded() !== null) {
- $time_spent = $usertime->getDateEnded() - $usertime->getDateStarted();
- $time_ended = phabricator_datetime($usertime->getDateEnded(), $viewer);
- } else {
- $time_spent = time() - $usertime->getDateStarted();
- }
+ $block = new PhrequentTimeBlock(array($usertime));
+ $time_spent = $block->getTimeSpentOnObject(
+ $usertime->getObjectPHID(),
+ PhabricatorTime::getNow());
$time_spent = $time_spent == 0 ? 'none' :
phutil_format_relative_time_detailed($time_spent);
@@ -172,7 +170,7 @@
$item->addAttribute(
pht(
'Ended on %s',
- $time_ended));
+ phabricator_datetime($usertime->getDateEnded(), $viewer)));
} else {
$item->addAttribute(
pht(
diff --git a/src/applications/phrequent/query/PhrequentUserTimeQuery.php b/src/applications/phrequent/query/PhrequentUserTimeQuery.php
--- a/src/applications/phrequent/query/PhrequentUserTimeQuery.php
+++ b/src/applications/phrequent/query/PhrequentUserTimeQuery.php
@@ -199,10 +199,31 @@
$u_start = $u_event->getDateStarted();
$u_end = $u_event->getDateEnded();
- if (($u_start >= $e_start) &&
- ($u_end === null || $u_end > $e_start)) {
- $select[] = $u_event;
+ if ($u_start < $e_start) {
+ // This event started before our event started, so it's not
+ // preempting us.
+ continue;
+ }
+
+ if ($u_start == $e_start) {
+ if ($u_event->getID() < $event->getID()) {
+ // This event started at the same time as our event started,
+ // but has a lower ID, so it's not preempting us.
+ continue;
+ }
+ }
+
+ if (($e_end !== null) && ($u_start > $e_end)) {
+ // Our event has ended, and this event started after it ended.
+ continue;
}
+
+ if (($u_end !== null) && ($u_end < $e_start)) {
+ // This event ended before our event began.
+ continue;
+ }
+
+ $select[] = $u_event;
}
$event->attachPreemptingEvents($select);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 15, 12:29 AM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710617
Default Alt Text
D10223.id24590.diff (3 KB)
Attached To
Mode
D10223: Account for preempting events on the Phrequent list view
Attached
Detach File
Event Timeline
Log In to Comment