|
|
|
@ -64,12 +64,11 @@ module WelcomeHelper
|
|
|
|
|
(c1.take(max)+c2).take(sum)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def find_miracle_project(sum=10, max_rate=7)
|
|
|
|
|
def find_miracle_project(sum, max_rate)
|
|
|
|
|
max = sum*(max_rate.to_f/10)
|
|
|
|
|
c1 = find_new_project(sum).to_a.dup
|
|
|
|
|
c2 = find_all_hot_project(sum).to_a.dup
|
|
|
|
|
c2 = c2 - c1
|
|
|
|
|
(c1.take(max)+c2).take(sum)
|
|
|
|
|
(c2.take(sum-max)+c1.take(max)).take(sum)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def find_new_course limit=15
|
|
|
|
@ -77,7 +76,7 @@ module WelcomeHelper
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def find_new_project limit=15
|
|
|
|
|
Project.visible.joins(:course_extra).where("#{Project.table_name}.project_type = ? ", 0).order("courses.time DESC, #{Project.table_name}.created_on DESC").limit(limit).all
|
|
|
|
|
Project.visible.where("#{Project.table_name}.project_type = ? ", 0).order("#{Project.table_name}.updated_on DESC, #{Project.table_name}.created_on DESC").limit(limit).all
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|