summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Core/Lexer.php1
-rw-r--r--app/Model/TaskFilter.php13
2 files changed, 12 insertions, 2 deletions
diff --git a/app/Core/Lexer.php b/app/Core/Lexer.php
index f6978bbd..3887dc82 100644
--- a/app/Core/Lexer.php
+++ b/app/Core/Lexer.php
@@ -40,6 +40,7 @@ class Lexer
'/^(yesterday|tomorrow|today)/' => 'T_DATE',
'/^("(.*?)")/' => 'T_STRING',
"/^(\w+)/" => 'T_STRING',
+ "/^(#\d+)/" => 'T_STRING',
);
/**
diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php
index 0bac3f46..c88be830 100644
--- a/app/Model/TaskFilter.php
+++ b/app/Model/TaskFilter.php
@@ -173,7 +173,7 @@ class TaskFilter extends Base
}
/**
- * Filter by title
+ * Filter by title or id if the string is like #123 or an integer
*
* @access public
* @param string $title
@@ -181,7 +181,16 @@ class TaskFilter extends Base
*/
public function filterByTitle($title)
{
- $this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
+ if (strlen($title) > 1 && $title{0} === '#' && ctype_digit(substr($title, 1))) {
+ $this->query->eq(Task::TABLE.'.id', substr($title, 1));
+ }
+ else if (ctype_digit($title)) {
+ $this->query->eq(Task::TABLE.'.id', $title);
+ }
+ else {
+ $this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
+ }
+
return $this;
}