Feature #31225

Show the number of days left until the due date in reminders

Added by Go MAEDA 8 months ago. Updated 7 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Email notifications
Target version:4.1.0
Resolution:Fixed

Description

It is useful if we can know the due date of each issue in reminder. I think that adding information "Due in X days" or "X days late" for each issue is nice.

[Before]

* eCookbook - Bug #1: Cannot print recipes
* OnlineStore - Bug #4: Issue on project 2
* eCookbook - Feature request #2: Add ingredients categories

[After]

* eCookbook - Bug #1: Cannot print recipes (Due in 3 days)
* OnlineStore - Bug #4: Issue on project 2 (Due in 1 days)
* eCookbook - Feature request #2: Add ingredients categories (3 days late)

31225_show_days_until_due_date.patch Magnifier (3.92 KB) Yuichi HARADA, 2019-05-17 04:24

31225_fix_test.patch Magnifier (8.09 KB) Yuichi HARADA, 2019-05-20 07:22

31225_fix_test_v2.patch Magnifier (5.32 KB) Yuichi HARADA, 2019-05-22 02:45

24941_set_time_zone_to_utc.patch Magnifier (2.62 KB) Go MAEDA, 2019-05-22 06:49


Related issues

Related to Redmine - Patch #6357: Show and sort by due_date in reminders Closed 2010-09-10
Related to Redmine - Feature #23778: default sort email reminders by due date (and list due da... Closed

Associated revisions

Revision 18174
Added by Go MAEDA 7 months ago

Show the number of days left until the due date in reminders (#31225).

Patch by Yuichi HARADA.

Revision 18190
Added by Go MAEDA 7 months ago

MailerTest fails depending on the time (#31225).

Patch by Go MAEDA.

History

#1 Updated by Go MAEDA 8 months ago

I noticed a few weeks ago that reminders from Planio already has the information. It is really useful.

#2 Updated by Go MAEDA 7 months ago

  • Related to Patch #6357: Show and sort by due_date in reminders added

#3 Updated by Go MAEDA 7 months ago

  • Related to Feature #23778: default sort email reminders by due date (and list due date in email) added

#4 Updated by Yuichi HARADA 7 months ago

+1
I think it is useful because I can understand the number of days until the due date.
I attached a patch.

#5 Updated by Go MAEDA 7 months ago

  • Target version set to Candidate for next major release

#6 Updated by Go MAEDA 7 months ago

  • Target version changed from Candidate for next major release to 4.1.0

I applied this patch to my production environment and found that the information "Due in X days" / "X days late" is useful. It made me realize that there were too many overdue issues!

I am setting the target version to 4.1.0.

#7 Updated by Go MAEDA 7 months ago

  • Subject changed from Show how many days are left until the due date in reminders to Show the number of days left until the due date in reminders
  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thanks.

#8 Updated by Go MAEDA 7 months ago

  • Status changed from Closed to Reopened

The tests fail depending on the timezone.

I think the error occurs when the date of the current timezone is different from the date in UTC. For example, I observed the following error on 20 May 2019 08:15:00 +0900 (19 May 2019 23:15:00 UTC)

F

Failure:
MailerTest#test_reminders_should_sort_issues_by_due_date [/Users/maeda/redmines/trunk/test/unit/mailer_test.rb:749]:
<(?-mix:foo \(1 day late\))> expected but was
<eCookbook - Bug #219: foo (2 days late)>..
Expected 0 to be >= 1.

bin/rails test test/unit/mailer_test.rb:738

#9 Updated by Yuichi HARADA 7 months ago

Go MAEDA wrote:

The tests fail depending on the timezone.

I think the error occurs when the date of the current timezone is different from the date in UTC. For example, I observed the following error on 20 May 2019 08:15:00 +0900 (19 May 2019 23:15:00 UTC)

[...]

Sorry, I fixed to the UTC Date at 0:00 using travel_to Date.today.to_time(:utc) .
This fix eliminates the dependency on time zones.

#10 Updated by Go MAEDA 7 months ago

Yuichi HARADA wrote:

Sorry, I fixed to the UTC Date at 0:00 using travel_to Date.today.to_time(:utc) .
This fix eliminates the dependency on time zones.

Unfortunately, tests still fail.

$ date
Tue May 21 00:22:38 JST 2019
$ bin/rails test test/unit/mailer_test.rb:622
Run options: --seed 55322

# Running:

F

Failure:
MailerTest#test_reminders [/Users/maeda/redmines/trunk/test/unit/mailer_test.rb:628]:
"Bug #3: Error 281 when updating a recipe (5 days late)" not found in "1 issue(s) that are assigned to you are due in the next 42 days::

* eCookbook - Bug #3: Error 281 when updating a recipe (6 days late)

View all issues (2 open)
http://localhost:3000/issues?assigned_to_id=me&set_filter=1&sort=due_date%3Aasc

--
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://hostname/my/account
" 

bin/rails test test/unit/mailer_test.rb:622

Finished in 1.727797s, 0.5788 runs/s, 2.3151 assertions/s.
1 runs, 4 assertions, 1 failures, 0 errors, 0 skips

#11 Updated by Yuichi HARADA 7 months ago

When replacing Time with Date, due_date was incorrect because timezone and time were truncated.
I rebuilt a test.

#12 Updated by Go MAEDA 7 months ago

Yuichi HARADA wrote:

When replacing Time with Date, due_date was incorrect because timezone and time were truncated.
I rebuilt a test.

Thank you for updating the test. I wrote a simpler patch.

The root cause of the test failure is that a time zone is not set for users in test fixtures. Because of that, the time zone of users while running test depends on the timezone of the PC, and the result of test will be unstable.

This patch fixes the problem by fixing the user's time zone to UTC while running mailer_test.

#13 Updated by Go MAEDA 7 months ago

  • Status changed from Reopened to Closed

Go MAEDA wrote:

The tests fail depending on the timezone.

I think the error occurs when the date of the current timezone is different from the date in UTC. For example, I observed the following error on 20 May 2019 08:15:00 +0900 (19 May 2019 23:15:00 UTC)

[...]

Committed the fix #31225#note-12 in r18190.

Also available in: Atom PDF