From 5277eddb959662cb67adb89c447f32329b39b44a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 20 Jun 2014 09:40:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E8=A3=85=E8=8E=B7=E5=8F=96=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E4=BD=9C=E4=B8=9A=E5=8F=82=E4=B8=8E=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 13 +++++++++++++ app/views/bids/_homework_list.html.erb | 8 +------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 1bc11645..0e0456bd 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -236,4 +236,17 @@ module CoursesHelper finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score format("%.2f",finall_project_score) end + + #获取指定作业的参与人员 + #返回结果:张三、李四、王五 + def homework_user_of_homework homework,is_teacher + homework_users = "" + homework.users.each do |user| + homework_users = homework_users + (is_teacher ? user.realname : user.name) + if user != homework.users.last + homework_users = homework_users + "、" + end + end + return homework_users + end end diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index a24c8b32..451324ce 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -72,13 +72,7 @@ 合作成员:  - <% homework_users = "" %> - <% homework.users.each do |user| %> - <% homework_users = homework_users + (is_teacher ? user.realname : user.name) %> - <% if user != homework.users.last %> - <% homework_users = homework_users + "、" %> - <% end %> - <% end %> + <% homework_users = homework_user_of_homework(homework,is_teacher) %> <% if homework.users.count == 0 %> 无 <% else %>