打分增加打分角色的判定
This commit is contained in:
parent
d80ade96c8
commit
52834d8fa9
|
@ -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.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.user_id = User.current.id
|
||||||
@score.student_work_id = @work.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
|
@is_new = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,23 @@ module StudentWorkHelper
|
||||||
when 1
|
when 1
|
||||||
role = "教师"
|
role = "教师"
|
||||||
when 2
|
when 2
|
||||||
role = "教辅"
|
role = "助教"
|
||||||
when 3
|
when 3
|
||||||
role = "学生"
|
role = "学生"
|
||||||
end
|
end
|
||||||
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
|
end
|
|
@ -38,7 +38,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="ping_box" id="score_list_<%= @work.id%>">
|
<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%>">
|
<div id="work_score_<%= score.id%>">
|
||||||
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
|
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue