diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2006-12-11 21:25:50 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2006-12-11 21:25:50 +0000 |
commit | 256eb6250e69ea1943d2eb3239fb12d80adb2397 (patch) | |
tree | aa3320d4ad62c958005dfeb754db1f1f252941bd /app | |
parent | e50ba150c3e256561d384e3ae1575d75118407e6 (diff) | |
download | redmine-256eb6250e69ea1943d2eb3239fb12d80adb2397.tar.gz redmine-256eb6250e69ea1943d2eb3239fb12d80adb2397.zip |
bug fixed in projects/activity due to sql join
documents added in projects/activity
git-svn-id: http://redmine.rubyforge.org/svn/trunk@84 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects_controller.rb | 8 | ||||
-rw-r--r-- | app/views/projects/activity.rhtml | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6718b8312..ada0f3795 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -389,7 +389,7 @@ class ProjectsController < ApplicationController end
unless params[:show_files] == "0"
- Attachment.find(:all, :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to] ).each { |i|
+ Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to] ).each { |i|
@events_by_day[i.created_on.to_date] ||= []
@events_by_day[i.created_on.to_date] << i
}
@@ -397,7 +397,11 @@ class ProjectsController < ApplicationController end
unless params[:show_documents] == "0"
- Attachment.find(:all, :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to] ).each { |i|
+ @project.documents.find(:all, :conditions => ["documents.created_on>=? and documents.created_on<=?", @date_from, @date_to] ).each { |i|
+ @events_by_day[i.created_on.to_date] ||= []
+ @events_by_day[i.created_on.to_date] << i
+ }
+ Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to] ).each { |i|
@events_by_day[i.created_on.to_date] ||= []
@events_by_day[i.created_on.to_date] << i
}
diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml index 4050d62c1..9afe8ff25 100644 --- a/app/views/projects/activity.rhtml +++ b/app/views/projects/activity.rhtml @@ -25,11 +25,13 @@ <% unless e.summary.empty? %><%= e.summary %><br /><% end %>
<i><%= e.author.name %></i>
<% elsif (e.is_a? Attachment) and (e.container.is_a? Version) %>
- <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%> (Version <%= e.container.name %>): <%= link_to e.filename, :controller => 'projects', :action => 'list_files', :id => @project %><br />
+ <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%> (<%= e.container.name %>): <%= link_to e.filename, :controller => 'projects', :action => 'list_files', :id => @project %><br />
<i><%= e.author.name %></i>
<% elsif (e.is_a? Attachment) and (e.container.is_a? Document) %>
- <%= e.created_on.strftime("%H:%M") %> <%=l(:label_document)%>: <%= link_to e.container.title, :controller => 'documents', :action => 'show', :id => e %><br />
+ <%= e.created_on.strftime("%H:%M") %> <%=l(:label_attachment)%>: <%= e.filename %> (<%= link_to e.container.title, :controller => 'documents', :action => 'show', :id => e.container %>)<br />
<i><%= e.author.name %></i>
+ <% elsif e.is_a? Document %>
+ <%= e.created_on.strftime("%H:%M") %> <%=l(:label_document)%>: <%= link_to e.title, :controller => 'documents', :action => 'show', :id => e %><br />
<% end %>
</p></li>
|