https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292017-09-04T11:24:04ZRedmineRedmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=809342017-09-04T11:24:04ZАлександр Курутин
<ul></ul><p>7 years have passed, but there is still no filter (next month).</p> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=850572018-05-17T18:40:38ZSebastian Paluch
<ul></ul><p>+1</p> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=852372018-05-27T08:47:10ZGo MAEDA
<ul><li><strong>Category</strong> set to <i>Issues filter</i></li></ul> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=890812018-12-18T11:25:55ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-3 status-5 priority-4 priority-default closed" href="/issues/18868">Patch #18868</a>: Add support for queries with 'next week' filter</i> added</li></ul> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=890832018-12-18T11:31:18ZGo MAEDA
<ul></ul><p>Redmine 4.0.0 has "yesterday", "last week", and "last month" filter but does not "tomorrow", "next week", and "next month" filter.</p>
<p>I think those filters should be useful for many users.</p> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=892962019-01-10T00:48:13ZMizuki ISHIKAWA
<ul><li><strong>File</strong> <a href="/attachments/22138">add-next-range-filters.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/22138/add-next-range-filters.patch">add-next-range-filters.patch</a> added</li></ul><p>Go MAEDA wrote:</p>
<blockquote>
<p>Redmine 4.0.0 has "yesterday", "last week", and "last month" filter but does not "tomorrow", "next week", and "next month" filter.</p>
<p>I think those filters should be useful for many users.</p>
</blockquote>
<p>I wrote a patch to add "tomorrow", "next week", and "next month" filter.<br />It is useful to have this filter when checking the tasks to be executed next month, next week, tomorrow.</p> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=892982019-01-10T01:42:36ZMizuki ISHIKAWA
<ul><li><strong>File</strong> <a href="/attachments/22139">add-next-range-filters-v2.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/22139/add-next-range-filters-v2.patch">add-next-range-filters-v2.patch</a> added</li></ul><p>I fixed patch because unnecessary tests were included.</p> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=893562019-01-12T02:39:33ZMarius BĂLTEANU
<ul><li><strong>Target version</strong> set to <i>Candidate for next major release</i></li></ul><p>LGTM</p> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=893682019-01-13T04:44:41ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/22158">operators@2x.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/22158/operators@2x.png">operators@2x.png</a> added</li><li><strong>Target version</strong> changed from <i>Candidate for next major release</i> to <i>4.1.0</i></li></ul><p>Setting the target version to 4.1.0.</p>
<p>I propose reordering the operators as follows. While the current patch shows operators in "present -> past -> future" order, my change shows operators in "future -> present -> past" order. For example, operators will be ordered like "tomorrow, today, yesterday" and "next week, this week, last week, last 2 weeks" instead of "today, yesterday, tomorrow" and "this week, last week, last 2 weeks, next week". The proposing order is a tidy reverse-chronological order and should be intuitive.</p>
<pre><code class="ruby syntaxhl"> <span class="ss">:date</span> <span class="o">=></span> <span class="p">[</span> <span class="s2">"="</span><span class="p">,</span> <span class="s2">">="</span><span class="p">,</span> <span class="s2">"<="</span><span class="p">,</span> <span class="s2">"><"</span><span class="p">,</span> <span class="s2">"<t+"</span><span class="p">,</span> <span class="s2">">t+"</span><span class="p">,</span> <span class="s2">"><t+"</span><span class="p">,</span> <span class="s2">"t+"</span><span class="p">,</span> <span class="s2">"nd"</span><span class="p">,</span> <span class="s2">"t"</span><span class="p">,</span> <span class="s2">"ld"</span><span class="p">,</span> <span class="s2">"nw"</span><span class="p">,</span> <span class="s2">"w"</span><span class="p">,</span> <span class="s2">"lw"</span><span class="p">,</span> <span class="s2">"l2w"</span><span class="p">,</span> <span class="s2">"nm"</span><span class="p">,</span> <span class="s2">"m"</span><span class="p">,</span> <span class="s2">"lm"</span><span class="p">,</span> <span class="s2">"y"</span><span class="p">,</span> <span class="s2">">t-"</span><span class="p">,</span> <span class="s2">"<t-"</span><span class="p">,</span> <span class="s2">"><t-"</span><span class="p">,</span> <span class="s2">"t-"</span><span class="p">,</span> <span class="s2">"!*"</span><span class="p">,</span> <span class="s2">"*"</span> <span class="p">],</span>
</code></pre>
<p><img src="https://www.redmine.org/attachments/download/22158/operators@2x.png" srcset="https://www.redmine.org/attachments/download/22158/operators@2x.png 2x" style="width: 160px;" alt="" /></p> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=894922019-01-18T08:39:15ZGo MAEDA
<ul><li><strong>Subject</strong> changed from <i>Query date filters by months (prev, this, next)</i> to <i>New date filter operators: tomorrow, next week, next month</i></li></ul> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=895052019-01-19T07:43:48ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Go MAEDA</i></li></ul><p>Committed the patch. Thank you for improving Redmine.</p>
<p>I changed the order or operators and added Japanese translation.</p> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=895102019-01-19T08:33:01ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Reopened</i></li></ul><p>QueryTest#test_operator_tomorrow fails depending on timezone.</p>
<p>I could reproduce the problem at 22:21 HST (Hawaii Standard Time -1000, 08:21 UTC). Maybe the problem occurs if the local date is different from the UTC date.</p>
<pre>
$ date
Fri Jan 18 22:21:34 HST 2019
$ ruby test/unit/query_test.rb
Run options: --seed 35057
# Running:
.................................................................................................................F
Failure:
QueryTest#test_operator_tomorrow [test/unit/query_test.rb:645]:
Expected false to be truthy.
bin/rails test test/unit/query_test.rb:641
...............................................................................................
Finished in 22.371776s, 9.3421 runs/s, 26.4619 assertions/s.
209 runs, 592 assertions, 1 failures, 0 errors, 0 skips
</pre> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=895122019-01-19T09:52:56ZGo MAEDA
<ul></ul><p>The current date of my PC is 2019-01-18 HST (2019-01-19 UTC).</p>
<p>QueryTest#test_operator_tomorrow expects that there are some issues whose due date is tomorrow (2019-01-19). However, there are issues whose due date is the day after the tomorrow (2019-01-20).</p>
<pre>
sqlite> select id, due_date from issues;
id due_date
---------- ----------
1 2019-01-29
2
3 2019-01-14
4
5
6 2019-01-20
7 2019-01-18
8
9 2019-01-20
10 2019-01-20
11
12
13
14
</pre>
<p>Probably the reason is that the timezone of fixtures is UTC. <code>1.days.from_now.to_date.to_s(:db)</code> returns a date in UTC (2019-01-20), while the test code expects 2019-01-19 that is the date of tomorrow in the local time (the current date of the local time is still 2019-01-18 HST).</p>
<pre>
issues_006:
created_on: <%= 1.minute.ago.to_s(:db) %>
project_id: 5
updated_on: <%= 1.minute.ago.to_s(:db) %>
priority_id: 4
subject: Issue of a private subproject
id: 6
fixed_version_id:
category_id:
description: This is an issue of a private subproject of cookbook
tracker_id: 1
assigned_to_id:
author_id: 2
status_id: 1
start_date: <%= Date.today.to_s(:db) %>
due_date: <%= 1.days.from_now.to_date.to_s(:db) %>
root_id: 6
lft: 1
rgt: 2
</pre>
<p>The date of fixtures are UTC, I think we have to run the test in UTC. The following workaround resolves the failing test.</p>
<pre><code class="diff syntaxhl"><span class="gh">Index: test/unit/query_test.rb
===================================================================
</span><span class="gd">--- test/unit/query_test.rb (revision 17811)
</span><span class="gi">+++ test/unit/query_test.rb (working copy)
</span><span class="p">@@ -639,11 +639,13 @@</span>
end
def test_operator_tomorrow
<span class="gi">+ User.current = User.find_by_login('admin')
+ User.current.pref.update_attribute :time_zone, 'UTC'
</span> query = IssueQuery.new(:project => Project.find(1), :name => '_')
query.add_filter('due_date', 'nd', [''])
issues = find_issues_with_query(query)
assert !issues.empty?
<span class="gd">- issues.each {|issue| assert_equal Date.today.tomorrow, issue.due_date}
</span><span class="gi">+ issues.each {|issue| assert_equal User.current.today.tomorrow, issue.due_date}
</span> end
def test_operator_date_periods
</code></pre> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=905692019-03-05T02:21:03ZMizuki ISHIKAWA
<ul><li><strong>File</strong> <a href="/attachments/22562">fix_test.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/22562/fix_test.patch">fix_test.patch</a> added</li></ul><p>Go MAEDA wrote:</p>
<blockquote>
<p>QueryTest#test_operator_tomorrow fails depending on timezone.</p>
<p>I could reproduce the problem at 22:21 HST (Hawaii Standard Time -1000, 08:21 UTC). Maybe the problem occurs if the local date is different from the UTC date.</p>
</blockquote>
<p>Thank you for pointing that out.</p>
<p>The attached patch updates the <a class="issue tracker-3 status-5 priority-4 priority-default closed" title="Patch: New date filter operators: tomorrow, next week, next month (Closed)" href="https://www.redmine.org/issues/4502#note-13">#4502#note-13</a> test to fix the random failure.</p> Redmine - Patch #4502: New date filter operators: tomorrow, next week, next monthhttps://www.redmine.org/issues/4502?journal_id=907412019-03-14T13:33:31ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>Reopened</i> to <i>Closed</i></li></ul>