Merge branch 'bigchange' of 10.0.47.245:/home/trustie2 into bigchange
This commit is contained in:
commit
e5a3fea2b2
|
@ -10,10 +10,11 @@ class StoresController < ApplicationController
|
|||
LIMIT = 20 unless const_defined?(:LIMIT)
|
||||
def index
|
||||
#Document HomeworkAttach Issue Message News Version WikiPage
|
||||
projects_attach
|
||||
|
||||
@projects_attach = Attachment.includes(:attach_project).where("projects.project_type=?", 0).
|
||||
reorder("#{Attachment.table_name}.created_on DESC").
|
||||
limit(LIMIT)
|
||||
|
||||
@courses_attach = Attachment.includes(:attach_project).where("projects.project_type=?", 1).
|
||||
reorder("#{Attachment.table_name}.created_on DESC").
|
||||
limit(LIMIT)
|
||||
|
@ -25,4 +26,18 @@ class StoresController < ApplicationController
|
|||
limit(LIMIT)
|
||||
end
|
||||
|
||||
private
|
||||
#Document HomeworkAttach Issue Message News Version WikiPage
|
||||
def project_classification project_type=0
|
||||
#Document HomeworkAttach Issue Message News Version WikiPage
|
||||
doc_attach = Attachment.joins(str_join_table("documents")).where("projects.project_type=#{project_type}")
|
||||
issue_attach = Attachment.joins(str_join_table("issues")).where("projects.project_type=#{project_type}")
|
||||
mess_attach = Attachment.joins(str_join_table("messages")).where("projects.project_type=#{project_type}")
|
||||
end
|
||||
|
||||
def str_join_table tableName
|
||||
str = "LEFT JOIN #{tableName} ON attachments.container_id = #{tableName}.id
|
||||
LEFT JOIN projects ON #{tableName}.project_id = projects.id"
|
||||
str
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue