diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index d1835408f..a6dec8161 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -844,17 +844,29 @@ class StudentWorkController < ApplicationController
render_attachment_warning_if_needed(@new_score)
if @new_score.save
+ if @homework.homework_type == 3
+ @is_group_leader = !@work.student_work_projects.empty?
+ end
case @new_score.reviewer_role
when 1 #教师评分:最后一个教师评分为最终评分
@work.teacher_score = @new_score.score
+ if @is_group_leader
+ add_score_to_member @work, @homework, 1, 'teacher_score', @new_score.score
+ end
when 2 #教辅评分 教辅评分显示平均分
#@work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
@work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f
+ if @is_group_leader
+ add_score_to_member @work, @homework, 2, 'teaching_asistant_score', @work.teaching_asistant_score
+ end
when 3 #学生评分 学生评分显示平均分
#@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
@work.student_score = stu_score.first.score.try(:round, 2).to_f
+ if @is_group_leader
+ add_score_to_member @work, @homework, 3, 'student_score', @work.student_score
+ end
end
@homework.update_column('updated_at', Time.now)
update_course_activity(@homework.class,@homework.id)
@@ -1577,10 +1589,6 @@ class StudentWorkController < ApplicationController
end
end
end
- if homework.homework_type == 3
- student_works = group_student_works student_work, homework
- student_works.update_all(:final_score => student_work.final_score,:teacher_score => student_work.teacher_score,:student_score => student_work.student_score,:teaching_asistant_score => student_work.teaching_asistant_score,:work_score => student_work.work_score)
- end
end
end
end
diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb
index 1e7df6466..63344fa1a 100644
--- a/app/helpers/student_work_helper.rb
+++ b/app/helpers/student_work_helper.rb
@@ -165,4 +165,13 @@ module StudentWorkHelper
student_works = homework.student_works.where("user_id in #{user_ids}")
return student_works
end
+
+ def add_score_to_member student_work, homework, role, score_type, score
+ student_works = group_student_works student_work, homework
+ student_works.each do |st_work|
+ if st_work.student_works_scores.where("reviewer_role = #{role} and score is not null").empty?
+ st_work.update_attribute("#{score_type}", score)
+ end
+ end
+ end
end
\ No newline at end of file
diff --git a/app/models/student_work.rb b/app/models/student_work.rb
index 59e5b76bc..a3f692341 100644
--- a/app/models/student_work.rb
+++ b/app/models/student_work.rb
@@ -170,12 +170,6 @@ class StudentWork < ActiveRecord::Base
end
end
end
- if homework.homework_type == 3
- pros = student_work.student_work_projects.where("is_leader = 0")
- user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
- student_works = homework.student_works.where("user_id in #{user_ids}")
- student_works.update_all(:final_score => student_work.final_score,:teacher_score => student_work.teacher_score,:student_score => student_work.student_score,:teaching_asistant_score => student_work.teaching_asistant_score,:work_score => student_work.work_score)
- end
end
end
diff --git a/app/views/student_work/_evaluation_un_group.html.erb b/app/views/student_work/_evaluation_un_group.html.erb
new file mode 100644
index 000000000..d48d1a492
--- /dev/null
+++ b/app/views/student_work/_evaluation_un_group.html.erb
@@ -0,0 +1,13 @@
+
+ <% @stundet_works.each_with_index do |student_work, i| %>
+
+ <%= render :partial => 'evaluation_un_group_work', :locals => {:student_work => student_work} %>
+
+
+
+
+ <%= render :partial => 'group_member_work', :locals => {:student_work => student_work} %>
+
+ <% end %>
+
+
\ No newline at end of file
diff --git a/app/views/student_work/_evaluation_un_group_member_work.html.erb b/app/views/student_work/_evaluation_un_group_member_work.html.erb
new file mode 100644
index 000000000..63e515f89
--- /dev/null
+++ b/app/views/student_work/_evaluation_un_group_member_work.html.erb
@@ -0,0 +1,82 @@
+
+
+
\ No newline at end of file
diff --git a/app/views/student_work/_evaluation_un_group_work.html.erb b/app/views/student_work/_evaluation_un_group_work.html.erb
index b4337eeb2..f40928ddd 100644
--- a/app/views/student_work/_evaluation_un_group_work.html.erb
+++ b/app/views/student_work/_evaluation_un_group_work.html.erb
@@ -1,89 +1,73 @@
-
- |
- <%=index + 1 %> |
-
- <%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_activities_path(student_work.user)) %>
- |
- <% if @homework.homework_detail_group.base_on_project == 1 %>
-
-
- <%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
-
- |
- <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
-
- <% else %>
-
- <% end %>
- <% elsif @homework.homework_detail_group.base_on_project == 0 %>
-
- <% end %>
-
- <% if student_work.created_at && @homework.end_time%>
- <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
- <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
- [迟交]
- <% end %>
- <% end %>
- |
-
- <%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
- |
-
- <%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
- |
- <% if @homework.anonymous_comment == 0%>
-
- <% if student_work.student_score.nil? %>
- 未参与
- <% else %>
- <%=format("%.1f",student_work.student_score) %>
- <% end %>
- <% unless student_work.student_score.nil?%>
-
- (<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>)
+
+
+
+ <%=student_work.name %>
+
+ <% if student_work.work_status%>
+ <%=get_status student_work.work_status %>
+ <% end %>
-
- 现共有
- <%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>
- 名学生进行了匿评,平均分为
- <%= format("%.1f",student_work.student_score)%> 分。
+
+ <% if @homework.homework_detail_group.base_on_project == 1 %>
+ 关联项目:
+ <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
+ <%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "width:200px;", :title => "项目名称"%>
+ <% else %>
+ <%= student_work.project.name %>
+ <% end %>
+ <% end %>
+ 评分
+
+
+
+ 提交时间:<%=format_date(student_work.commit_time) %>
+
+ 教师:<%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
+ 助教:<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
+ <% if @homework.anonymous_comment == 0 %>
+ 匿评:
+
+ <% if student_work.student_score.nil? %>
+ 未参与
+ <% else %>
+ <%= format("%.1f", student_work.student_score) %>
+ <% end %>
+ <% unless student_work.student_score.nil? %>
+
+ (<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>)
+
+
+ 现共有
+ <%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>
+ 名学生进行了匿评,平均分为
+ <%= format("%.1f", student_work.student_score) %> 分。
+
+ <% end %>
+
+
+ <% end %>
+ 成绩:
+ <% score = student_work.work_score %>
+
+ <%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
+ <% unless score.nil?%>
+
+ 作品最终评分为
+ <%= student_work.final_score%> 分。
+ 迟交扣分
+
+ <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.late_penalty %>
+ 分,
+ 缺评扣分
+
+ <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty%>
+ 分,
+ 最终成绩为
+ <%= format("%.1f",score<0 ? 0 : score)%> 分。
<% end%>
- |
- <% end %>
-
- <% if student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score %>
- <% score = student_work.respond_to?("score") ? student_work.score : student_work.teacher_score %>
- <% else %>
- <% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
- <% end %>
-
- <%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
- <% unless score.nil?%>
-
- 作品最终评分为
- <%= student_work.final_score%> 分。
- 迟交扣分
-
- <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.late_penalty %>
- 分,
- 缺评扣分
-
- <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty%>
- 分,
- 最终成绩为
- <%= format("%.1f",score<0 ? 0 : score)%> 分。
-
- <% end%>
- |
- |
-
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/student_work/_group_member_work.html.erb b/app/views/student_work/_group_member_work.html.erb
new file mode 100644
index 000000000..bfe25c982
--- /dev/null
+++ b/app/views/student_work/_group_member_work.html.erb
@@ -0,0 +1,11 @@
+<% user_ids = student_work.student_work_projects.empty? ? "(-1)" : "(" + student_work.student_work_projects.map{|st| st.user_id}.join(",") + ")" %>
+<% student_work_groups = @homework.student_works.where("user_id in #{user_ids}").order("created_at asc") %>
+<% anon_count = student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>
+<% student_work_groups.each_with_index do |st, j| %>
+
+ <%= render :partial => 'evaluation_un_group_member_work', :locals => {:st => st, :anon_count => anon_count} %>
+
+ <% if j != 0 %>
+
+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/student_work/_group_work_show.html.erb b/app/views/student_work/_group_work_show.html.erb
new file mode 100644
index 000000000..00e90b2d0
--- /dev/null
+++ b/app/views/student_work/_group_work_show.html.erb
@@ -0,0 +1,145 @@
+
+
+ <% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %>
+ <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
+ <% is_my_work = pro && pro.student_work_id == work.id%>
+
+ -
+ 上交时间:
+ <%=format_time work.created_at %>
+
+
+ <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
+
+ -
+ <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %>
+
+ -
+ <%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%>
+
+ <% end%>
+ <% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %>
+
+ -
+ <%= render :partial => 'student_work_praise',:locals => {:work => work} %>
+
+ <% end%>
+
+
+
+
+ <% if work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %>
+
+ -
+ 参与人员:
+ <%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%>
+ <% members = work.student_work_projects.where("is_leader = 0") %>
+ <% members.each do |member| if !members.empty? %>
+ 、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %>
+ <% end %>
+ <% end %>
+
+ <% if @homework.homework_detail_group.base_on_project == 1 %>
+ -
+ 关联项目:
+ <% if work.project_id == 0 || work.project_id.nil? %>
+ 暂无
+ <% elsif work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %>
+ <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
+ (综合评分:<%=static_project_score(work.project.project_score).to_i %>)
+ <% else %>
+ <%=work.project.name %>
+ (综合评分:<%=static_project_score(work.project.project_score).to_i %>)
+ <% end %>
+ <%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
+
+ <% end %>
+ -
+ 内容:
+
+ <%= work.description.html_safe if work.description%>
+
+
+
+ -
+ 附件:
+ <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %>
+ <% if com_attachments.empty?%>
+ 尚未提交附件
+ <% else%>
+
+ <%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %>
+
+ <% end%>
+
+
+ <% end%>
+
+ -
+ <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
+
+
+ <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
+
+ <% end%>
+
+
+
+
+
+ <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>
+
+
+
+
+ <%student_work_scores.each do |student_score|%>
+
+ <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
+
+ <% 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 9f65376e3..feab67800 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -7,6 +7,8 @@
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
<% is_my_work = pro && pro.student_work_id == work.id%>
<% end %>
+ <% is_member_work = @homework.homework_type == 3 && work.student_work_projects.empty? %>
+ <% if !is_member_work %>
-
上交时间:
@@ -31,8 +33,7 @@
-
- <% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %>
+ <% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %>
-
参与人员:
@@ -58,42 +59,55 @@
<%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
<% end %>
- <% end%>
+ <% end%>
- -
- 内容:
-
- <%= work.description.html_safe if work.description%>
-
-
-
- -
- 附件:
- <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %>
- <% if com_attachments.empty?%>
+
-
+ 内容:
+
+ <%= work.description.html_safe if work.description%>
+
+
+
+ -
+ 附件:
+ <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %>
+ <% if com_attachments.empty?%>
尚未提交附件
- <% else%>
+ <% else%>
<%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %>
- <% end%>
-
-
- -
- <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
+ <% end%>
+
+
+ -
+ <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
- <% end%>
-
-
+ <% end%>
+
+
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>
+ <% else %>
+
+ <% end %>
<%student_work_scores.each do |student_score|%>
@@ -101,6 +115,9 @@
<%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
<% end%>
+ <% if is_member_work && student_work_scores.empty? %>
+ 暂无评分
+ <% end %>
diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb
index dbde6d24c..73f37602b 100644
--- a/app/views/student_work/_student_work_list.html.erb
+++ b/app/views/student_work/_student_work_list.html.erb
@@ -36,11 +36,19 @@
- <% if @is_evaluation && !@stundet_works.empty?%>
- <%= render :partial => "evaluation_title"%>
- <% else%>
- <%= render :partial => "evaluation_un_title"%>
- <% end%>
+ <% if @homework.homework_type != 3%>
+ <% if @is_evaluation && !@stundet_works.empty? %>
+ <%= render :partial => "evaluation_title"%>
+ <% else%>
+ <%= render :partial => "evaluation_un_title"%>
+ <% end%>
+ <% else %>
+ <% if !@is_teacher && @is_evaluation && !@stundet_works.empty? %>
+ <%= render :partial => "evaluation_title"%>
+ <% else %>
+ <%= render :partial => "evaluation_un_group"%>
+ <% end%>
+ <% end %>
diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb
index c961fb077..6acf9eb45 100644
--- a/app/views/student_work/add_score.js.erb
+++ b/app/views/student_work/add_score.js.erb
@@ -11,8 +11,18 @@ var num = $("#work_num_<%= @work.id%>").html();
$("#score_list_<%= @work.id%>").removeAttr("style");
<% if @is_teacher %>
- $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work, :index => 1}) %>");
- $("#work_num_<%= @work.id%>").html(num);
+ <% if @homework.homework_type == 3 %>
+ <% if @is_group_leader %>
+ $("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'evaluation_un_group_work', :locals => {:student_work => @work}) %>");
+ $("#group_member_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'group_member_work', :locals => {:student_work => @work}) %>");
+ <% else %>
+ <% anon_count = @work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>
+ $("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'evaluation_un_group_member_work', :locals => {:st => @work, :anon_count => anon_count}) %>");
+ <% end %>
+ <% else %>
+ $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_un_work',:locals => {:student_work => @work, :index => 1}) %>");
+ $("#work_num_<%= @work.id%>").html(num);
+ <% end %>
<% else %>
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1}) %>");
$("#work_num_<%= @work.id%>").html(num);
diff --git a/public/stylesheets/css/courses.css b/public/stylesheets/css/courses.css
index 77f7fdfe2..952273eab 100644
--- a/public/stylesheets/css/courses.css
+++ b/public/stylesheets/css/courses.css
@@ -234,6 +234,7 @@ a.hworkExport {background:url(/images/homepage_icon2.png) -10px -401px no-repeat
a.hworkSetting {background:url(/images/homepage_icon2.png) -10px -450px no-repeat; padding-left:23px;}
.hworkInfor {font-size:12px; color:#269ac9; width:80px; height:40px; vertical-align:middle; float:left; line-height:40px; text-align:center; font-weight:bold;}
.infoNi{ width:100px; padding:5px;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left; line-height:2; position:absolute; margin-top:-24px;margin-left: 40px; z-index:99;}
+.g_infoNi{ width:100px; padding:5px;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left; line-height:2; position:absolute; margin-top:10px;margin-left: 80px; z-index:99;}
.problemTxt {width:660px; margin-left:10px; color:#777777; position:relative;}
.rTxtTit{width:560px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#269ac9; font-size:14px;}
.hworkSearchBox {border:1px solid #e6e6e6; width:185px; float:left; background-color:#ffffff;}
diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css
index d4ba7b86c..1c0ffc2ef 100644
--- a/public/stylesheets/css/public.css
+++ b/public/stylesheets/css/public.css
@@ -1459,3 +1459,7 @@ a:hover.sy_btn_green{ background: #51a74f;}
.invite_code_tip_box em {display:block; border-width:10px; position:absolute;top:26px; left:-20px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;}
.invite_code_tip_box span {display:block; border-width:10px; position:absolute;top:26px; left:-18px; border-style:dashed solid dashed dashed; border-color:transparent #fff transparent transparent; font-size:0; line-height:0;}
+/*flex布局*/
+.flex-container {display:flex;}
+.flex-cell {flex:1;}
+.flex-cell:last-child {text-align:right;}