|
|
|
@ -17,6 +17,7 @@
|
|
|
|
|
|
|
|
|
|
class WelcomeController < ApplicationController
|
|
|
|
|
caches_action :robots
|
|
|
|
|
before_filter :fake, :only => [:index, :course]
|
|
|
|
|
before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [:index]
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
@ -34,9 +35,9 @@ class WelcomeController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def course
|
|
|
|
|
@course = Project.course_entities
|
|
|
|
|
@teacher = User.teacher
|
|
|
|
|
@student = User.student
|
|
|
|
|
@courseCount = Project.course_entities.count
|
|
|
|
|
@teacherCount = User.teacher.count
|
|
|
|
|
@studentCount = User.student.count
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def contest
|
|
|
|
@ -90,4 +91,25 @@ class WelcomeController < ApplicationController
|
|
|
|
|
return 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def render(*args)
|
|
|
|
|
_fake if @fake_filter
|
|
|
|
|
super
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def fake
|
|
|
|
|
@fake_filter = true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def _fake
|
|
|
|
|
instance_variables.map { |variable|
|
|
|
|
|
if variable.to_s =~ /Count$/
|
|
|
|
|
self.instance_variable_set(variable.to_sym,
|
|
|
|
|
("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
|
|
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|