プロジェクト

全般

プロフィール

Vote #79593

完了

Sort issues by due date in email reminders

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Email notifications_9
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
9
version_id:
99
issue_org_id:
29771
author_id:
332
assigned_to_id:
332
comments:
7
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Currently, it seems that issues in email reminders are not sorted, or sorted in a less meaningful order for humans.

I think it is useful for most users to sort issues by the due date in descending order (overdue issues are shown first).


journals

--------------------------------------------------------------------------------
Currently, the order of arrangement depends on the DBMS. (In no order)

Go MAEDA wrote:
> I think it is useful for most users to sort issues by the due date in descending order (overdue issues are shown first).
I made a patch, and attach it.
<pre><code class="diff">
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 468e6c21a..800fdde88 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -27,7 +27,7 @@ class Mailer < ActionMailer::Base
include Roadie::Rails::Automatic

# Overrides ActionMailer::Base#process in order to set the recipient as the current user
- # and his language as the default locale.
+ # and his language as the default locale.
# The first argument of all actions of this Mailer must be a User (the recipient),
# otherwise an ArgumentError is raised.
def process(action, *args)
@@ -584,6 +584,7 @@ class Mailer < ActionMailer::Base
issues_by_assignee.each do |assignee, issues|
if assignee.is_a?(User) && assignee.active? && issues.present?
visible_issues = issues.select {|i| i.visible?(assignee)}
+ visible_issues.sort!{|a, b| (b.due_date <=> a.due_date).nonzero? || (a.id <=> b.id)}
reminder(assignee, visible_issues, days).deliver_later if visible_issues.present?
end
end
</code></pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Thank you for posting the patch. The patch works fine for me.

I slightly updated the test code in Yuichi HARADA's patch to make it even easier to read. Attaching the new patch.
--------------------------------------------------------------------------------
Go MAEDA wrote:
> I slightly updated the test code in Yuichi HARADA's patch to make it even easier to read. Attaching the new patch.
It is easy to understand using assert_select.

--------------------------------------------------------------------------------
Yuichi HARADA wrote:
> Go MAEDA wrote:
> > I slightly updated the test code in Yuichi HARADA's patch to make it even easier to read. Attaching the new patch.
> It is easy to understand using assert_select.
I'm sorry.
The new patch was not attach.

I changed due_date in ascending order, because overdue issues are shown first.
I rebuilt a patch, and attach it.

--------------------------------------------------------------------------------
Committed. Thank you for improving Redmine.
--------------------------------------------------------------------------------


related_issues

relates,Closed,6357,Show and sort by due_date in reminders

Admin Redmine さんが3年以上前に更新

  • カテゴリEmail notifications_9 にセット
  • 対象バージョン4.0.0_99 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0