mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Add "Date Updated" query fields for Maniphest
Summary: Fixes T4637. - We already allow you to order by this column but don't have a key on it. Add one. - Expose UI for querying on ranges. Test Plan: - Ran some queries, got reasonable-looking results and no table scans. Reviewers: btrahan, bigo Reviewed By: bigo Subscribers: bigo, epriestley Maniphest Tasks: T4637 Differential Revision: https://secure.phabricator.com/D8557
This commit is contained in:
parent
ba8925a531
commit
5b2887b69b
3 changed files with 49 additions and 0 deletions
2
resources/sql/autopatches/20140317.mupdatedkey.sql
Normal file
2
resources/sql/autopatches/20140317.mupdatedkey.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_maniphest.maniphest_task
|
||||
ADD KEY `key_dateModified` (dateModified);
|
|
@ -22,6 +22,8 @@ final class ManiphestTaskQuery
|
|||
private $includeNoProject = null;
|
||||
private $dateCreatedAfter;
|
||||
private $dateCreatedBefore;
|
||||
private $dateModifiedAfter;
|
||||
private $dateModifiedBefore;
|
||||
|
||||
private $fullTextSearch = '';
|
||||
|
||||
|
@ -153,6 +155,16 @@ final class ManiphestTaskQuery
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function withDateModifiedBefore($date_modified_before) {
|
||||
$this->dateModifiedBefore = $date_modified_before;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withDateModifiedAfter($date_modified_after) {
|
||||
$this->dateModifiedAfter = $date_modified_after;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function loadPage() {
|
||||
|
||||
// TODO: (T603) It is possible for a user to find the PHID of a project
|
||||
|
@ -193,6 +205,20 @@ final class ManiphestTaskQuery
|
|||
$this->dateCreatedBefore);
|
||||
}
|
||||
|
||||
if ($this->dateModifiedAfter) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'dateModified >= %d',
|
||||
$this->dateModifiedAfter);
|
||||
}
|
||||
|
||||
if ($this->dateModifiedBefore) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'dateModified <= %d',
|
||||
$this->dateModifiedBefore);
|
||||
}
|
||||
|
||||
$where[] = $this->buildPagingClause($conn);
|
||||
|
||||
$where = $this->formatWhereClause($where);
|
||||
|
|
|
@ -64,6 +64,8 @@ final class ManiphestTaskSearchEngine
|
|||
|
||||
$saved->setParameter('createdStart', $request->getStr('createdStart'));
|
||||
$saved->setParameter('createdEnd', $request->getStr('createdEnd'));
|
||||
$saved->setParameter('modifiedStart', $request->getStr('modifiedStart'));
|
||||
$saved->setParameter('modifiedEnd', $request->getStr('modifiedEnd'));
|
||||
|
||||
$limit = $request->getInt('limit');
|
||||
if ($limit > 0) {
|
||||
|
@ -170,6 +172,17 @@ final class ManiphestTaskSearchEngine
|
|||
$query->withDateCreatedBefore($end);
|
||||
}
|
||||
|
||||
$mod_start = $this->parseDateTime($saved->getParameter('modifiedStart'));
|
||||
$mod_end = $this->parseDateTime($saved->getParameter('modifiedEnd'));
|
||||
|
||||
if ($mod_start) {
|
||||
$query->withDateModifiedAfter($mod_start);
|
||||
}
|
||||
|
||||
if ($mod_end) {
|
||||
$query->withDateModifiedBefore($mod_end);
|
||||
}
|
||||
|
||||
$this->applyCustomFieldsToQuery($query, $saved);
|
||||
|
||||
return $query;
|
||||
|
@ -344,6 +357,14 @@ final class ManiphestTaskSearchEngine
|
|||
'createdEnd',
|
||||
pht('Created Before'));
|
||||
|
||||
$this->buildDateRange(
|
||||
$form,
|
||||
$saved,
|
||||
'modifiedStart',
|
||||
pht('Updated After'),
|
||||
'modifiedEnd',
|
||||
pht('Updated Before'));
|
||||
|
||||
$form
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
|
|
Loading…
Reference in a new issue