members split (teacher,student) in course

This commit is contained in:
yanxd 2013-10-31 10:57:46 +08:00
parent b617f3d42f
commit 2286fbeff5
7 changed files with 2528 additions and 2465 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,8 @@ module ApplicationHelper
include AvatarHelper include AvatarHelper
## added by william ## added by william
include PraiseTreadHelper include PraiseTreadHelper
# add by nyan
include CoursesHelper
extend Forwardable extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter

View File

@ -0,0 +1,28 @@
## This helper be included in applicationHelper
module CoursesHelper
# 返回学生数量即roles表中定义的Reporter 返回结果 -1 为查询失败
def studentCount project
searchCountByRoles project, 5
end
# 返回教师数量即roles表中定义的Manager 返回结果 -1 为查询失败
def teacherCount project
searchCountByRoles project, 3
end
# 返回TA数量即roles表中定义的TA 返回结果 -1 为查询失败
def teacherAssistantCount project
searchCountByRoles project, 7
end
# 根据角色查询
def searchCountByRoles project, roles_id
count = -1
begin
count = project.members.joins(:member_roles).where("member_roles.role_id = :role_id", {:role_id => roles_id }).count
rescue Exception => e
logger.error "[CoursesHelper] ===> #{e}"
end
count
end
end

View File

@ -80,13 +80,28 @@
<% files_count += version.attachments.count %> <% files_count += version.attachments.count %>
<% end %> <% end %>
<td class="font_index"><%= link_to "#{@project.members.count}", project_member_path(@project) ,:course =>'1'%></td> <td class="font_index">
<!-- %= link_to "#{@project.members.count}", project_member_path(@project) ,:course =>'1'% -->
<!-- 1 教师; 2 学生0 全部-->
<%= link_to "#{teacherCount(@project)}", project_member_path(@project, :role => 1) ,:course =>'1'%>
</td>
<td class="font_index">
<%= link_to "#{studentCount(@project)}", project_member_path(@project, :role => 2) ,:course =>'1'%>
</td>
<td class="font_index"><%= link_to files_count, project_files_path(@project) %></td> <td class="font_index"><%= link_to files_count, project_files_path(@project) %></td>
<tr class="font_aram"> <tr class="font_aram">
<td align="center" width="80px"> <%= l(:label_x_base_courses_member, :count => @project.members.count) %></td> <td align="center" width="80px" id="teacherCount">
<!-- %= l(:label_x_base_courses_member, :count => @project.members.count) % -->
<%= l(:label_x_base_courses_teacher, :count => teacherCount(@project)) %>
</td>
<td align="center" width="80px" id="studentCount">
<%= l(:label_x_base_courses_student, :count => studentCount(@project)) %>
<!-- %= l(:label_x_course_data, :count => files_count) % -->
</td>
<td align="center" width="80px">
<%= l(:label_x_course_data, :count => files_count) %>
</td>
<td align="center" width="80px"><%= l(:label_x_course_data, :count => files_count) %></td>
</tr> </tr>
</table> </table>
<div class="user_underline"></div> <div class="user_underline"></div>
@ -188,6 +203,7 @@
</div> </div>
<%= render :partial => 'layouts/base_footer'%> <%= render :partial => 'layouts/base_footer'%>
<%= debug(params) if Rails.env.development? %>
</div> </div>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">

View File

@ -1,6 +1,6 @@
<div class="member_header"> <div class="member_header">
<p> <p>
<%= l(:label_member_list)%> <%= l(:label_member_list) if params[:role].blank? %>
</p> </p>
</div> </div>
<div class="member_content"> <div class="member_content">

File diff suppressed because it is too large Load Diff

View File

@ -716,7 +716,7 @@ zh:
label_sort_higher: 上移 label_sort_higher: 上移
label_sort_lower: 下移 label_sort_lower: 下移
label_sort_lowest: 置底 label_sort_lowest: 置底
label_roadmap: 路线图 label_roadmap: 版本路线图 #nyan
label_roadmap_due_in: "截止日期到 %{value}" label_roadmap_due_in: "截止日期到 %{value}"
label_roadmap_overdue: "%{value} 延期" label_roadmap_overdue: "%{value} 延期"
label_roadmap_no_issues: 该版本没有问题 label_roadmap_no_issues: 该版本没有问题
@ -1563,6 +1563,14 @@ zh:
zero: 资料 zero: 资料
one: 资料 one: 资料
other: 资料 other: 资料
label_x_base_courses_student:
zero: 学生
one: 学生
other: 学生
label_x_base_courses_teacher:
zero: 教师
one: 教师
other: 教师
label_homework_statistics: 作业统计 label_homework_statistics: 作业统计
label_technical_title: 职称 label_technical_title: 职称
@ -1616,9 +1624,9 @@ zh:
label_contest_list: 竞赛列表 label_contest_list: 竞赛列表
label_x_base_courses_member: label_x_base_courses_member:
zero: 成员 zero: 学生
one: 成员 one: 学生
other: 成员 other: 学生
label_bids_task_list: 作业列表 label_bids_task_list: 作业列表
label_join_course: 加入课程 label_join_course: 加入课程