Commit fea83e65 authored by maeda's avatar maeda

Performance improvement when rendering news or calendar block on My page (#30249).

Patch by Go MAEDA.


git-svn-id: https://svn.redmine.org/redmine/trunk@17771 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 73d16583
...@@ -78,7 +78,7 @@ module MyHelper ...@@ -78,7 +78,7 @@ module MyHelper
def render_calendar_block(block, settings) def render_calendar_block(block, settings)
calendar = Redmine::Helpers::Calendar.new(User.current.today, current_language, :week) calendar = Redmine::Helpers::Calendar.new(User.current.today, current_language, :week)
calendar.events = Issue.visible. calendar.events = Issue.visible.
where(:project_id => User.current.projects.pluck(:id)). where(:project => User.current.projects).
where("(start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)", calendar.startdt, calendar.enddt, calendar.startdt, calendar.enddt). where("(start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)", calendar.startdt, calendar.enddt, calendar.startdt, calendar.enddt).
includes(:project, :tracker, :priority, :assigned_to). includes(:project, :tracker, :priority, :assigned_to).
references(:project, :tracker, :priority, :assigned_to). references(:project, :tracker, :priority, :assigned_to).
...@@ -142,7 +142,7 @@ module MyHelper ...@@ -142,7 +142,7 @@ module MyHelper
def render_news_block(block, settings) def render_news_block(block, settings)
news = News.visible. news = News.visible.
where(:project_id => User.current.projects.pluck(:id)). where(:project => User.current.projects).
limit(10). limit(10).
includes(:project, :author). includes(:project, :author).
references(:project, :author). references(:project, :author).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment