summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Filter/BaseDateRangeFilter.php8
-rw-r--r--app/Filter/TaskCompletionDateRangeFilter.php38
-rw-r--r--app/Filter/TaskModificationDateRangeFilter.php38
-rw-r--r--app/ServiceProvider/FilterProvider.php8
4 files changed, 88 insertions, 4 deletions
diff --git a/app/Filter/BaseDateRangeFilter.php b/app/Filter/BaseDateRangeFilter.php
index 336f8c8e..fcff0d4c 100644
--- a/app/Filter/BaseDateRangeFilter.php
+++ b/app/Filter/BaseDateRangeFilter.php
@@ -42,10 +42,10 @@ abstract class BaseDateRangeFilter extends BaseFilter
protected function applyDateFilter($field)
{
$dates = explode('..', $this->value);
-
- if(count($dates)=== 2){
- $timestampFrom = $this->dateParser->getTimestamp($dates[0]);
- $timestampTo = $this->dateParser->getTimestamp($dates[1]);
+
+ if(count($dates)=== 2){
+ $timestampFrom = $this->dateParser->getTimestamp($dates[0]." 00:00");
+ $timestampTo = $this->dateParser->getTimestamp($dates[1]." 00:00");
$this->query->gte($field, $timestampFrom);
$this->query->lte($field, $timestampTo + 86399);
diff --git a/app/Filter/TaskCompletionDateRangeFilter.php b/app/Filter/TaskCompletionDateRangeFilter.php
new file mode 100644
index 00000000..9272cc1e
--- /dev/null
+++ b/app/Filter/TaskCompletionDateRangeFilter.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Kanboard\Filter;
+
+use Kanboard\Core\Filter\FilterInterface;
+use Kanboard\Model\TaskModel;
+
+/**
+ * Filter tasks by completion date
+ *
+ * @package filter
+ * @author Kamil Ściana
+ */
+class TaskCompletionDateRangeFilter extends BaseDateRangeFilter implements FilterInterface
+{
+ /**
+ * Get search attribute
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getAttributes()
+ {
+ return array('completedRange');
+ }
+
+ /**
+ * Apply filter
+ *
+ * @access public
+ * @return FilterInterface
+ */
+ public function apply()
+ {
+ $this->applyDateFilter(TaskModel::TABLE.'.date_completed');
+ return $this;
+ }
+}
diff --git a/app/Filter/TaskModificationDateRangeFilter.php b/app/Filter/TaskModificationDateRangeFilter.php
new file mode 100644
index 00000000..3daa2b59
--- /dev/null
+++ b/app/Filter/TaskModificationDateRangeFilter.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Kanboard\Filter;
+
+use Kanboard\Core\Filter\FilterInterface;
+use Kanboard\Model\TaskModel;
+
+/**
+ * Filter tasks by modification date
+ *
+ * @package filter
+ * @author Kamil Ściana
+ */
+class TaskModificationDateRangeFilter extends BaseDateRangeFilter implements FilterInterface
+{
+ /**
+ * Get search attribute
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getAttributes()
+ {
+ return array('updatedRange', 'modifiedRange');
+ }
+
+ /**
+ * Apply filter
+ *
+ * @access public
+ * @return FilterInterface
+ */
+ public function apply()
+ {
+ $this->applyDateFilter(TaskModel::TABLE.'.date_modification');
+ return $this;
+ }
+}
diff --git a/app/ServiceProvider/FilterProvider.php b/app/ServiceProvider/FilterProvider.php
index c61d2284..392c6c92 100644
--- a/app/ServiceProvider/FilterProvider.php
+++ b/app/ServiceProvider/FilterProvider.php
@@ -15,6 +15,7 @@ use Kanboard\Filter\TaskColorFilter;
use Kanboard\Filter\TaskColumnFilter;
use Kanboard\Filter\TaskCommentFilter;
use Kanboard\Filter\TaskCompletionDateFilter;
+use Kanboard\Filter\TaskCompletionDateRangeFilter;
use Kanboard\Filter\TaskCreationDateFilter;
use Kanboard\Filter\TaskCreationDateRangeFilter;
use Kanboard\Filter\TaskCreatorFilter;
@@ -24,6 +25,7 @@ use Kanboard\Filter\TaskStartDateFilter;
use Kanboard\Filter\TaskIdFilter;
use Kanboard\Filter\TaskLinkFilter;
use Kanboard\Filter\TaskModificationDateFilter;
+use Kanboard\Filter\TaskModificationDateRangeFilter;
use Kanboard\Filter\TaskMovedDateFilter;
use Kanboard\Filter\TaskMovedDateRangeFilter;
use Kanboard\Filter\TaskPriorityFilter;
@@ -166,6 +168,9 @@ class FilterProvider implements ServiceProviderInterface
->withFilter(TaskCompletionDateFilter::getInstance()
->setDateparser($c['dateParser'])
)
+ ->withFilter(TaskCompletionDateRangeFilter::getInstance()
+ ->setDateparser($c['dateParser'])
+ )
->withFilter(new TaskIdFilter())
->withFilter(TaskLinkFilter::getInstance()
->setDatabase($c['db'])
@@ -173,6 +178,9 @@ class FilterProvider implements ServiceProviderInterface
->withFilter(TaskModificationDateFilter::getInstance()
->setDateParser($c['dateParser'])
)
+ ->withFilter(TaskModificationDateRangeFilter::getInstance()
+ ->setDateParser($c['dateParser'])
+ )
->withFilter(TaskMovedDateFilter::getInstance()
->setDateParser($c['dateParser'])
)