打分增加打分角色的判定

This commit is contained in:
sw 2015-05-27 16:21:59 +08:00
parent d80ade96c8
commit 52834d8fa9
3 changed files with 18 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -38,7 +38,7 @@
</ul>
<div class="ping_box" id="score_list_<%= @work.id%>">
<%@work.student_works_scores.each do |score|%>
<%@work.student_works_scores.order("created_at desc").each do |score|%>
<div id="work_score_<%= score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
</div>