修复资源标记搜索不正确的BUG issues#1089

This commit is contained in:
sw 2014-07-31 14:39:18 +08:00
parent 2c689b6399
commit 8b80d99a70
3 changed files with 15 additions and 13 deletions

View File

@ -72,7 +72,7 @@ class TagsController < ApplicationController
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@obj_flag,@selected_tags)
@ -108,7 +108,7 @@ class TagsController < ApplicationController
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
@ -131,7 +131,7 @@ class TagsController < ApplicationController
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
@ -199,7 +199,7 @@ class TagsController < ApplicationController
@bids_results = nil
@contests_results = nil
@forums_results = nil
attachments_results = nil
@attachments_results = nil
@open_source_projects_results = nil
@obj_pages = nil
@obj = nil
@ -228,8 +228,9 @@ class TagsController < ApplicationController
# modifed by Long Jun
# this is used to find the attachments that came from the same project and tagged with the same tag.
@result = get_attachments_by_project_tag(selected_tags, @obj)
@obj_pages, attachments_results, @results_count = for_pagination(@result)
#@result = get_attachments_by_project_tag(selected_tags, @obj)
@result = get_attachments_by_tag(selected_tags)
@obj_pages, @attachments_results, @results_count = for_pagination(@result)
when '7'
@obj = Contest.find_by_id(obj_id)
@obj_pages,@contests_results,@results_count = for_pagination(get_contests_by_tag(selected_tags))
@ -250,7 +251,7 @@ class TagsController < ApplicationController
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results]

View File

@ -87,8 +87,9 @@ module AttachmentsHelper
@project_id = obj.container_id
end
Attachment.tagged_with(tag_name).order('created_on desc').where("(container_id = :project_id and container_type = 'Project') or
attachments = Attachment.tagged_with(tag_name).order('created_on desc').where("(container_id = :project_id and container_type = 'Project') or
(container_id in (select id from versions where project_id =:project_id) and container_type = 'Version')", {:project_id => @project_id})
return attachments
end

View File

@ -1,5 +1,5 @@
<div id="issues">
<% if attachments_results.try(:size).to_i < 0 %>
<% if attachments_results.nil? || attachments_results.try(:size).to_i < 0 %>
<% else %>
<hr />
<% attachments_results.each do |file| %>