mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42: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 $includeNoProject = null;
|
||||||
private $dateCreatedAfter;
|
private $dateCreatedAfter;
|
||||||
private $dateCreatedBefore;
|
private $dateCreatedBefore;
|
||||||
|
private $dateModifiedAfter;
|
||||||
|
private $dateModifiedBefore;
|
||||||
|
|
||||||
private $fullTextSearch = '';
|
private $fullTextSearch = '';
|
||||||
|
|
||||||
|
@ -153,6 +155,16 @@ final class ManiphestTaskQuery
|
||||||
return $this;
|
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() {
|
public function loadPage() {
|
||||||
|
|
||||||
// TODO: (T603) It is possible for a user to find the PHID of a project
|
// TODO: (T603) It is possible for a user to find the PHID of a project
|
||||||
|
@ -193,6 +205,20 @@ final class ManiphestTaskQuery
|
||||||
$this->dateCreatedBefore);
|
$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->buildPagingClause($conn);
|
||||||
|
|
||||||
$where = $this->formatWhereClause($where);
|
$where = $this->formatWhereClause($where);
|
||||||
|
|
|
@ -64,6 +64,8 @@ final class ManiphestTaskSearchEngine
|
||||||
|
|
||||||
$saved->setParameter('createdStart', $request->getStr('createdStart'));
|
$saved->setParameter('createdStart', $request->getStr('createdStart'));
|
||||||
$saved->setParameter('createdEnd', $request->getStr('createdEnd'));
|
$saved->setParameter('createdEnd', $request->getStr('createdEnd'));
|
||||||
|
$saved->setParameter('modifiedStart', $request->getStr('modifiedStart'));
|
||||||
|
$saved->setParameter('modifiedEnd', $request->getStr('modifiedEnd'));
|
||||||
|
|
||||||
$limit = $request->getInt('limit');
|
$limit = $request->getInt('limit');
|
||||||
if ($limit > 0) {
|
if ($limit > 0) {
|
||||||
|
@ -170,6 +172,17 @@ final class ManiphestTaskSearchEngine
|
||||||
$query->withDateCreatedBefore($end);
|
$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);
|
$this->applyCustomFieldsToQuery($query, $saved);
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
|
@ -344,6 +357,14 @@ final class ManiphestTaskSearchEngine
|
||||||
'createdEnd',
|
'createdEnd',
|
||||||
pht('Created Before'));
|
pht('Created Before'));
|
||||||
|
|
||||||
|
$this->buildDateRange(
|
||||||
|
$form,
|
||||||
|
$saved,
|
||||||
|
'modifiedStart',
|
||||||
|
pht('Updated After'),
|
||||||
|
'modifiedEnd',
|
||||||
|
pht('Updated Before'));
|
||||||
|
|
||||||
$form
|
$form
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormTextControl())
|
id(new AphrontFormTextControl())
|
||||||
|
|
Loading…
Reference in a new issue