Merge branch 'bigchange' of 10.0.47.245:/home/trustie2 into bigchange
This commit is contained in:
commit
db60ece59f
|
@ -9,15 +9,15 @@ class StoresController < ApplicationController
|
||||||
# include ActsAsTaggableOn::TagsHelper
|
# include ActsAsTaggableOn::TagsHelper
|
||||||
LIMIT = 20 unless const_defined?(:LIMIT)
|
LIMIT = 20 unless const_defined?(:LIMIT)
|
||||||
def index
|
def index
|
||||||
@projects_attach = project_classification(0).take(LIMIT)
|
# @projects_attach = project_classification(0).take(LIMIT)
|
||||||
@courses_attach = project_classification(1).take(LIMIT)
|
# @courses_attach = project_classification(1).take(LIMIT)
|
||||||
# @projects_attach = Attachment.includes(:projects).where("projects.project_type=?", 0).
|
@projects_attach = Attachment.includes(:project).where("projects.project_type=?", 0).
|
||||||
# reorder("#{Attachment.table_name}.created_on DESC").
|
reorder("#{Attachment.table_name}.downloads DESC").
|
||||||
# limit(LIMIT)
|
limit(LIMIT)
|
||||||
|
|
||||||
# @courses_attach = Attachment.includes(:projects).where("projects.project_type=?", 1).
|
@courses_attach = Attachment.includes(:project).where("projects.project_type=?", 1).
|
||||||
# reorder("#{Attachment.table_name}.created_on DESC").
|
reorder("#{Attachment.table_name}.downloads 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,16 +31,16 @@ 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").
|
pro_attach = Attachment.joins("LEFT JOIN projects ON attachments.container_id = projects.id").
|
||||||
where("projects.project_type=#{project_type}").
|
where("projects.project_type=#{project_type}").
|
||||||
reorder("downloads").
|
reorder("downloads DESC").
|
||||||
limit(LIMIT)
|
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
|
||||||
news_attach = join_tools_project "news", project_type
|
news_attach = join_tools_project "news", project_type
|
||||||
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
|
||||||
|
|
||||||
tmp = 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 }
|
tmp.sort { |a, b| b.downloads <=> a.downloads }
|
||||||
|
|
Loading…
Reference in New Issue