From 52834d8fa96a19737a2f7763a99ce0729c32d0fb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 27 May 2015 16:21:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=88=86=E5=A2=9E=E5=8A=A0=E6=89=93?= =?UTF-8?q?=E5=88=86=E8=A7=92=E8=89=B2=E7=9A=84=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 3 ++- app/helpers/student_work_helper.rb | 16 +++++++++++++++- app/views/student_work/_show.html.erb | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index d5bbd6586..66ccfc8c0 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -85,7 +85,8 @@ class StudentWorkController < ApplicationController @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" @score.user_id = User.current.id @score.student_work_id = @work.id - @score.reviewer_role = 1 + role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name + @score.reviewer_role = get_role_by_name(role) @is_new = true end diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 20a85f19e..94da5f152 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -31,9 +31,23 @@ module StudentWorkHelper when 1 role = "教师" when 2 - role = "教辅" + role = "助教" when 3 role = "学生" end end + + def get_role_by_name role + case role + when "Teacher" + result = 1 + when "Manager" + result = 1 + when "TeachingAsistant" + result = 2 + when "Student" + result = 3 + end + result + end end \ No newline at end of file diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index fae1c1e89..ab41eda65 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -38,7 +38,7 @@