分组作业评阅中没有显示其他组员的名字,label需要替换新样式
This commit is contained in:
parent
dcd34e1098
commit
31898cbc4f
|
|
@ -723,7 +723,8 @@ class StudentWorkController < ApplicationController
|
|||
@student_work_scores = student_work_score_record(@work)
|
||||
end
|
||||
if @homework.homework_type == 3
|
||||
ids = @work.student_work_projects.map(&:user_id)
|
||||
member_work = group_member_work @work
|
||||
ids = member_work.student_work_projects.map(&:user_id)
|
||||
if ids.include?(User.current.id)
|
||||
ids = ids - [User.current.id]
|
||||
end
|
||||
|
|
@ -985,7 +986,7 @@ class StudentWorkController < ApplicationController
|
|||
case @new_score.reviewer_role
|
||||
when 1 #教师评分:最后一个教师评分为最终评分
|
||||
@work.teacher_score = @new_score.score
|
||||
if @is_group_leader && params[:same_score]
|
||||
if params[:same_score]
|
||||
add_score_to_member @work, @homework, @new_score
|
||||
end
|
||||
when 2 #教辅评分 教辅评分显示平均分
|
||||
|
|
@ -996,7 +997,7 @@ class StudentWorkController < ApplicationController
|
|||
else
|
||||
@work.teaching_asistant_score = @new_score.score
|
||||
end
|
||||
if @is_group_leader && params[:same_score]
|
||||
if params[:same_score]
|
||||
add_score_to_member @work, @homework, @new_score
|
||||
end
|
||||
when 3 #学生评分 学生评分显示平均分
|
||||
|
|
|
|||
|
|
@ -240,15 +240,29 @@ module StudentWorkHelper
|
|||
return status
|
||||
end
|
||||
|
||||
def group_student_works student_work, homework
|
||||
pros = student_work.student_work_projects.where("is_leader = 0")
|
||||
def group_member_work student_work
|
||||
member_work = nil
|
||||
if student_work.student_work_projects.count > 0
|
||||
member_work = student_work
|
||||
else
|
||||
student_work_pro = StudentWorkProject.where(:user_id => student_work.user_id, :homework_common_id => student_work.homework_common_id).first
|
||||
if student_work_pro
|
||||
member_work = StudentWork.find student_work_pro.student_work_id
|
||||
end
|
||||
end
|
||||
member_work
|
||||
end
|
||||
|
||||
def group_student_works member_work, student_work, homework
|
||||
pros = member_work.student_work_projects.where("user_id != #{student_work.user_id}")
|
||||
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||
student_works = homework.student_works.where("user_id in #{user_ids}")
|
||||
return student_works
|
||||
end
|
||||
|
||||
def add_score_to_member student_work, homework, new_score
|
||||
student_works = group_student_works student_work, homework
|
||||
member_work = group_member_work student_work
|
||||
student_works = group_student_works member_work, student_work, homework
|
||||
student_works.each do |st_work|
|
||||
st_work.student_works_scores << StudentWorksScore.create(:user_id => new_score.user_id, :score => new_score.score, :reviewer_role => new_score.reviewer_role, :comment => new_score.comment)
|
||||
if new_score.reviewer_role == 1
|
||||
|
|
@ -257,7 +271,7 @@ module StudentWorkHelper
|
|||
ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{st_work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
||||
st_work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f
|
||||
else
|
||||
st_work.student_score = student_work.student_score
|
||||
st_work.student_score = member_work.student_score
|
||||
end
|
||||
st_work.save
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@
|
|||
<span style="margin-left: 90px;display: none;" class="color-red" id="none_notice_<%= @work.id%>">评语、评分至少有一个不为空。</span>
|
||||
<ul>
|
||||
<li class="clearfix mb15">
|
||||
<label class=" panel-form-label fl color-grey" style="width:80px;"> 评语 </label>
|
||||
<label class="panel-form-label fl color-grey" style="width:80px;"> 评语 </label>
|
||||
<%= f.text_area 'user_message', :class => 'edu-reply-teat panel-box-sizing fl', :id => 'score_comment_'+@work.id.to_s, :placeholder => "录入你对本作品的评语,最多1000个字符", :maxlength => 1000 %>
|
||||
<div class="cl"></div>
|
||||
<p id="hint_message_<%=@work.id %>" class="color-red" style="margin-left: 90px; display: none;"></p>
|
||||
</li>
|
||||
<% is_member_work = (@work.homework_common.homework_type == 3 && @work.student_work_projects.empty?) %>
|
||||
<% if @is_teacher && @work.homework_common.homework_type == 3 && !is_member_work %>
|
||||
<% if @is_teacher && @work.homework_common.homework_type == 3 %>
|
||||
<li class="clearfix mb15">
|
||||
<label class="panel-form-label fl color-grey" style="width:80px;"> 批量评分 </label>
|
||||
<input type="checkbox" class="fl mt15"><span class="fl ml10 color-grey font-12 mt10">组员同评(选中,则本次评阅对象指小组全部成员;否则,仅指此成员1人)</span>
|
||||
<input type="checkbox" id="same_score" name="same_score" value="1" class="fl magic-checkbox">
|
||||
<label for="same_score" class="fl ml10 color-grey font-12 mt5">整组同评(选中,则本次评阅对象指小组全部成员;否则,仅指此成员1人)</label>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="clearfix mb15">
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<div class="panel-comment_item mt20" style="border-top:1px solid #eee;" id="score_content_list" >
|
||||
<%= render :partial => 'student_work_score_records', :locals => {:student_work_scores => @student_work_scores, :is_member_work => false} %>
|
||||
<%= render :partial => 'student_work_score_records', :locals => {:student_work_scores => @student_work_scores} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@
|
|||
</div>
|
||||
<% end%>
|
||||
|
||||
<% if is_member_work && student_work_scores.empty? && !@is_teacher %>
|
||||
<p class="c_red" style="text-align: center">暂无评分</p>
|
||||
<% end %>
|
||||
<%# if is_member_work && student_work_scores.empty? && !@is_teacher %>
|
||||
<!--<p class="c_red" style="text-align: center">暂无评分</p>-->
|
||||
<%# end %>
|
||||
|
|
@ -55,6 +55,23 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @homework.homework_type == 3 %>
|
||||
<% unless @team_work.count == 0 %>
|
||||
<div class="edu-con-bg01 mt15" >
|
||||
<div class="edu-con-top clearfix ">
|
||||
<p class="ml15 font-bd">其他组员</p>
|
||||
</div>
|
||||
<div class="edu-tab-con-box ">
|
||||
<div class="clearfix">
|
||||
<% @team_work.each do |team_work| %>
|
||||
<a href="<%= user_path(team_work) %>" class="fl mr15 link-color-blue"><%= team_work.try(:show_name) %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% elsif @homework.homework_type == 2 %>
|
||||
<% unless @work.description.blank? %>
|
||||
<div class="edu-con-bg01 mt15">
|
||||
|
|
@ -150,22 +167,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% elsif @homework.homework_type == 3 %>
|
||||
<% unless @team_work.count == 0 %>
|
||||
<div class="edu-con-bg01 mt15" >
|
||||
<div class="edu-con-top clearfix ">
|
||||
<p class="ml15 font-bd">其他组员</p>
|
||||
</div>
|
||||
<div class="edu-tab-con-box ">
|
||||
<div class="clearfix">
|
||||
<% @team_work.each do |team_work| %>
|
||||
<a href="<%= user_path(team_work) %>" class=" fl mr15 link-color-blue"><%= team_work.try(:show_name) %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue