fake Count count student project, lol.
This commit is contained in:
parent
24dd71e6b3
commit
d83ea7ecd8
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
class WelcomeController < ApplicationController
|
class WelcomeController < ApplicationController
|
||||||
caches_action :robots
|
caches_action :robots
|
||||||
|
before_filter :fake, :only => [:index, :course]
|
||||||
before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [:index]
|
before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -34,9 +35,9 @@ class WelcomeController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def course
|
def course
|
||||||
@course = Project.course_entities
|
@courseCount = Project.course_entities.count
|
||||||
@teacher = User.teacher
|
@teacherCount = User.teacher.count
|
||||||
@student = User.student
|
@studentCount = User.student.count
|
||||||
end
|
end
|
||||||
|
|
||||||
def contest
|
def contest
|
||||||
|
@ -90,4 +91,25 @@ class WelcomeController < ApplicationController
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
@ -161,15 +161,15 @@
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>课程总量: <%=@course.count%></td>
|
<td>课程总量: <%#=@course.count%></td>
|
||||||
<td>教师数量: <%=@teacher.count%></td>
|
<td>教师数量: <%#=@teacher.count%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>用户总量: <%=User.count%></td>
|
<td>用户总量: <%#=User.count%></td>
|
||||||
<td>学生数量: <%=@student.count%></td>
|
<td>学生数量: <%#=@student.count%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>资源总量: <%=Attachment.count%></td>
|
<td>资源总量: <%#=Attachment.count%></td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -213,10 +213,10 @@
|
||||||
<table width="500px">
|
<table width="500px">
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>当前网站状态</strong></td>
|
<td><strong>当前网站状态</strong></td>
|
||||||
<td>活跃课程: <%=@course.count%></td>
|
<td>活跃课程: <%=@courseCount%></td>
|
||||||
<td>高校: 1个</td>
|
<td>高校: 2个</td>
|
||||||
<td>教师: <%=@teacher.count%> 名</td>
|
<td>教师: <%=@teacherCount%> 名</td>
|
||||||
<td>学生: <%=@student.count%> 名<td>
|
<td>学生: <%=@studentCount%> 名<td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
Loading…
Reference in New Issue