diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index a4830f2ec..34734bf54 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -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
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index a9f6aee6e..0dc8e6983 100644
--- a/app/views/welcome/course.html.erb
+++ b/app/views/welcome/course.html.erb
@@ -161,15 +161,15 @@
- 课程总量: <%=@course.count%> |
- 教师数量: <%=@teacher.count%> |
+ 课程总量: <%#=@course.count%> |
+ 教师数量: <%#=@teacher.count%> |
- 用户总量: <%=User.count%> |
- 学生数量: <%=@student.count%> |
+ 用户总量: <%#=User.count%> |
+ 学生数量: <%#=@student.count%> |
- 资源总量: <%=Attachment.count%> |
+ 资源总量: <%#=Attachment.count%> |
|
@@ -213,10 +213,10 @@
当前网站状态 |
- 活跃课程: <%=@course.count%> |
- 高校: 1个 |
- 教师: <%=@teacher.count%> 名 |
- 学生: <%=@student.count%> 名 |
+ | 活跃课程: <%=@courseCount%> |
+ 高校: 2个 |
+ 教师: <%=@teacherCount%> 名 |
+ 学生: <%=@studentCount%> 名 |
|