summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Core/Lexer.php4
-rw-r--r--app/Model/TaskFilter.php20
2 files changed, 23 insertions, 1 deletions
diff --git a/app/Core/Lexer.php b/app/Core/Lexer.php
index a81965c5..34d85704 100644
--- a/app/Core/Lexer.php
+++ b/app/Core/Lexer.php
@@ -28,6 +28,7 @@ class Lexer
"/^(assignee:)/" => 'T_ASSIGNEE',
"/^(color:)/" => 'T_COLOR',
"/^(due:)/" => 'T_DUE',
+ "/^(status:)/" => 'T_STATUS',
"/^(title:)/" => 'T_TITLE',
"/^(\s+)/" => 'T_WHITESPACE',
'/^([<=>]{0,2}[0-9]{4}-[0-9]{2}-[0-9]{2})/' => 'T_DATE',
@@ -114,10 +115,11 @@ class Lexer
break;
+ case 'T_STATUS':
case 'T_DUE':
$next = next($tokens);
- if ($next !== false && $next['token'] === 'T_DATE') {
+ if ($next !== false && ($next['token'] === 'T_DATE' || $next['token'] === 'T_STRING')) {
$map[$token['token']] = $next['match'];
}
diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php
index c47b059f..6577c9b4 100644
--- a/app/Model/TaskFilter.php
+++ b/app/Model/TaskFilter.php
@@ -53,6 +53,9 @@ class TaskFilter extends Base
case 'T_TITLE':
$this->filterByTitle($value);
break;
+ case 'T_STATUS':
+ $this->filterByStatusName($value);
+ break;
}
}
@@ -297,6 +300,22 @@ class TaskFilter extends Base
}
/**
+ * Filter by status name
+ *
+ * @access public
+ * @param string $status
+ * @return TaskFilter
+ */
+ public function filterByStatusName($status)
+ {
+ if ($status === 'open' || $status === 'closed') {
+ $this->filterByStatus($status === 'open' ? Task::STATUS_OPEN : Task::STATUS_CLOSED);
+ }
+
+ return $this;
+ }
+
+ /**
* Filter by status
*
* @access public
@@ -321,6 +340,7 @@ class TaskFilter extends Base
*/
public function filterByDueDate($date)
{
+ $this->query->neq('date_due', '');
$this->query->neq('date_due', 0);
$this->query->notNull('date_due');
return $this->filterWithOperator('date_due', $date, true);