Searching for stale tasks, no updates in 5 days


#1

Hello,
We are trying this filter:
status:open modified:<"-5 days"
to find tasks that haven’t had any modification in the last 5 days. It seems to work, except it doesn’t detect comments as modifications. For us, putting a comment is a modification (a status update).

Does anyone have any suggestion? How can we filter for tasks that have had no comment and no update in the last 5 days?

Thanks!


#2

either create a custom filter to address it, or override the comment controller to also update the taskmodel modification date when comments are added or modified.

the first would be the simplest. might be as simple as just adding a date filter to comments and then using both filters, i.e. status:open modified:<"-5 days" comment_modified:<"-5 days"

with your custom filter looking something like:

class CommentModificationDateFilter extends BaseDateFilter implements FilterInterface
{
    /**
     * Get search attribute
     */
    public function getAttributes()
    {
        return array('comment_modified');
    }
    /**
     * Apply filter
     */
    public function apply()
    {
        $this->applyDateFilter(CommentModel::TABLE.'.date_modification');
        return $this;
    }
}

if you wanted to combine, something like this in the apply: (although I have a feeling it’s not this simple)

$this->query->beginOr()
        ->applyDateFilter(CommentModel::TABLE.'.date_modification');
        ->applyDateFilter(TaskModel::TABLE.'.date_modification');
        ->closeOr();

return $this;