|
|
@ -15,9 +15,9 @@ class StoresController < ApplicationController
|
|
|
|
# reorder("#{Attachment.table_name}.created_on DESC").
|
|
|
|
# reorder("#{Attachment.table_name}.created_on DESC").
|
|
|
|
# limit(LIMIT)
|
|
|
|
# limit(LIMIT)
|
|
|
|
|
|
|
|
|
|
|
|
# @courses_attach = Attachment.includes(:projects).where("projects.project_type=?", 1).
|
|
|
|
# @courses_attach = Attachment.includes(:projects).where("projects.project_type=?", 1).
|
|
|
|
# reorder("#{Attachment.table_name}.created_on DESC").
|
|
|
|
# reorder("#{Attachment.table_name}.created_on DESC").
|
|
|
|
# limit(LIMIT)
|
|
|
|
# limit(LIMIT)
|
|
|
|
@homeworks_attach = Attachment.where("container_type = 'HomeworkAttach'").
|
|
|
|
@homeworks_attach = Attachment.where("container_type = 'HomeworkAttach'").
|
|
|
|
reorder("created_on DESC").
|
|
|
|
reorder("created_on DESC").
|
|
|
|
limit(LIMIT)
|
|
|
|
limit(LIMIT)
|
|
|
@ -31,7 +31,10 @@ class StoresController < ApplicationController
|
|
|
|
private
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
|
|
def project_classification project_type=0
|
|
|
|
def project_classification project_type=0
|
|
|
|
pro_attach = Attachment.joins("LEFT JOIN projects ON attachments.container_id = projects.id").where("projects.project_type=#{project_type}")
|
|
|
|
pro_attach = Attachment.joins("LEFT JOIN projects ON attachments.container_id = projects.id").
|
|
|
|
|
|
|
|
where("projects.project_type=#{project_type}").
|
|
|
|
|
|
|
|
reorder("downloads").
|
|
|
|
|
|
|
|
limit(LIMIT)
|
|
|
|
doc_attach = join_tools_project "documents", project_type
|
|
|
|
doc_attach = join_tools_project "documents", project_type
|
|
|
|
issue_attach = join_tools_project "issues", project_type
|
|
|
|
issue_attach = join_tools_project "issues", project_type
|
|
|
|
mess_attach = []#join_tools_project "messages", project_type
|
|
|
|
mess_attach = []#join_tools_project "messages", project_type
|
|
|
@ -39,10 +42,14 @@ class StoresController < ApplicationController
|
|
|
|
vers_attach = join_tools_project "versions", project_type
|
|
|
|
vers_attach = join_tools_project "versions", project_type
|
|
|
|
wiki_attach = []#join_tools_project "wiki_pages", project_type
|
|
|
|
wiki_attach = []#join_tools_project "wiki_pages", project_type
|
|
|
|
|
|
|
|
|
|
|
|
pro_attach+doc_attach+issue_attach+mess_attach+news_attach+vers_attach+wiki_attach
|
|
|
|
tmp = pro_attach+doc_attach+issue_attach+mess_attach+news_attach+vers_attach+wiki_attach
|
|
|
|
|
|
|
|
tmp.sort { |a, b| b.downloads <=> a.downloads }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def join_tools_project tableName, project_type=0
|
|
|
|
def join_tools_project tableName, project_type=0
|
|
|
|
Attachment.joins(str_join_table(tableName)).where("projects.project_type=#{project_type}")
|
|
|
|
Attachment.joins(str_join_table(tableName)).
|
|
|
|
|
|
|
|
where("projects.project_type=#{project_type}").
|
|
|
|
|
|
|
|
reorder('downloads DESC').
|
|
|
|
|
|
|
|
limit(LIMIT)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def str_join_table tableName
|
|
|
|
def str_join_table tableName
|
|
|
|