diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 979f74aa4..ad22cb42c 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -829,22 +829,22 @@ class StudentWorkController < ApplicationController 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 + if @is_group_leader && params[:same_score] + add_score_to_member @work, @homework, @new_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 + if @is_group_leader && params[:same_score] + add_score_to_member @work, @homework, @new_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 + add_score_to_member @work, @homework, @new_score end end @homework.update_column('updated_at', Time.now) diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 954e0ba48..08dae571c 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -175,12 +175,19 @@ module StudentWorkHelper return student_works end - def add_score_to_member student_work, homework, role, score_type, score + def add_score_to_member student_work, homework, new_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) + 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 + st_work.teacher_score = new_score.score + elsif new_score.reviewer_role == 2 + 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 end + st_work.save end end end \ No newline at end of file diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index e051a4d99..3229ddbda 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -11,6 +11,9 @@
+ <% if @is_teacher && work.homework_common.homework_type == 3 && !is_member_work %> + + <% end %>
  • <% if @is_teacher%> 批阅结果: diff --git a/app/views/student_work/_evaluation_un_group.html.erb b/app/views/student_work/_evaluation_un_group.html.erb index 9a3364258..6b973aedc 100644 --- a/app/views/student_work/_evaluation_un_group.html.erb +++ b/app/views/student_work/_evaluation_un_group.html.erb @@ -3,8 +3,6 @@
    <%= render :partial => 'evaluation_un_group_work', :locals => {:student_work => student_work} %>
    -
    -
    <%= render :partial => 'group_member_work', :locals => {:student_work => student_work} %>
    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 index b078784c0..e50a3626e 100644 --- a/app/views/student_work/_evaluation_un_group_member_work.html.erb +++ b/app/views/student_work/_evaluation_un_group_member_work.html.erb @@ -2,30 +2,30 @@ <% is_expand = st.student_work_projects.empty? %> 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 583d5dd9e..54494ce57 100644 --- a/app/views/student_work/_evaluation_un_group_work.html.erb +++ b/app/views/student_work/_evaluation_un_group_work.html.erb @@ -1,98 +1,65 @@
    - - - - <% if student_work.work_status%> - <%=get_status student_work.work_status %> - <% end %> - - + + + + <% if student_work.work_status %> + <%= get_status student_work.work_status %> + <% end %> + + +
    <% 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 fr hidden', :style => "max-width:200px;", :title => "项目名称", :target => "_blank"%> + <%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:200px;", :title => "项目名称", :target => "_blank" %> <% elsif User.current.allowed_to?(:as_teacher, @homework.course) %> - <%= link_to student_work.project.name, applied_join_project_path(:object_id => student_work.project.id, :is_teacher => 1), :remote => true, :method => "post", :class => 'link-blue fr hidden', :style => "max-width:200px;", :title => "项目名称" %> + <%= link_to student_work.project.name, applied_join_project_path(:object_id => student_work.project.id, :is_teacher => 1), :remote => true, :method => "post", :class => 'link-blue fl hidden', :style => "max-width:200px;", :title => "项目名称" %> <% else %> <% end %> <% project = student_work.project %> -
    +
    +

    <%= project.name %>

    -

    创建者:<%=project.creater %>成员数量:<%=project.members.count %>

    + +

    + 创建者:<%= project.creater %>成员数量:<%= project.members.count %>

    <% project_score = project.project_score %> -

    项目综合得分:<%=static_project_score(project_score).to_i %>

    +

    项目综合得分:<%= static_project_score(project_score).to_i %>

    +

    = 代码提交得分 + issue得分 + 资源得分 + 帖子得分

    -

    = <%=(project_score.changeset_num||0) * 4 %> + <%=project_score.issue_num * 4 + project_score.issue_journal_num %> + <%=project_score.attach_num * 5 %> + <%=project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %>

    + +

    = <%= (project_score.changeset_num||0) * 4 %> + + <%= project_score.issue_num * 4 + project_score.issue_journal_num %> + <%= project_score.attach_num * 5 %> + + <%= project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %>

    - 关联项目: <% 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)%>
    + 提交时间:<%= format_date(student_work.commit_time) %> + 学号 + +
    +
    教师
    +
    助教
    <% 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.late_penalty %> -  分,
    - 缺评扣分 -   - <%= student_work.absence_penalty%> -  分,
    - 最终成绩为 -  <%= format("%.1f",score<0 ? 0 : score)%> 分。 -
    - <% end%> -
    -
    +
    成绩
    - 评分
    \ 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 index d9a2cf726..8ff10e513 100644 --- a/app/views/student_work/_group_member_work.html.erb +++ b/app/views/student_work/_group_member_work.html.erb @@ -5,7 +5,5 @@
    <%= 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/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 908b4a1d2..93493b5b4 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -94,7 +94,7 @@ <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%>
    - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> + <%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => false}%>
    <% end%>
    diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 786587d7b..185f6520b 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -84,7 +84,7 @@ <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
    - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> + <%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>
    <% end%>
    @@ -101,7 +101,7 @@ <% if @is_teacher %>
    - <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> + <%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>
    <% end%>
    diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index 94b033cd2..5a66b538c 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -2,7 +2,12 @@ 作品 - (<%= @student_work_count%><%=@homework.homework_type == 3 ? '组' : '人' %>已交) + <% if @homework.homework_type == 3 %> + <% member_count = @homework.student_works.where("work_status != 0").count %> + (<%= @student_work_count%>组<%=member_count %>人已交) + <% else %> + (<%= @student_work_count%>人已交) + <% end %> <%# my_work = @homework.student_works.where("user_id = #{User.current.id}").first %> <% my_work = cur_user_works_for_homework @homework %> @@ -40,8 +45,8 @@
    -

    大作品评分即组长的评分
    - 请先完成大作品评分,系统将把大作品
    评分做为每个组员的初始分值,您需
    要在此基础上对组员评分进行手动调整 +

    组长评分即小组作品评分
    + 组长评分时选择“组员同评”,本次评
    分结果将同时影响每个组员的评分。
    您可以继续对单个组员评分再调整或
    不调整

    <% end %> diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb index 5372360b9..ce9eee14d 100644 --- a/app/views/student_work/add_score.js.erb +++ b/app/views/student_work/add_score.js.erb @@ -1,4 +1,5 @@ -$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score}) %>"); +<% is_member_work = @homework.homework_type == 3 && @work.student_work_projects.empty? %> +$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score,:is_member_work => is_member_work}) %>"); $('#score_<%= @work.id%>').peSlider({range: 'min'}); <%# if @is_new%> @@ -7,7 +8,6 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'}); //$("#work_score_<%#= @score.id%>").html("<%#= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last}) %>"); <%# end%> -<% is_member_work = @homework.homework_type == 3 && @work.student_work_projects.empty? %> $("#score_list_<%= @work.id%>").replaceWith("<%=escape_javascript(render :partial => 'student_work_score_records', :locals => {:student_work_scores => @student_work_scores, :is_member_work => is_member_work}) %>"); var num = $("#work_num_<%= @work.id%>").html(); $("#score_list_<%= @work.id%>").removeAttr("style"); diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 47d6266b4..551f55b01 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1562,7 +1562,7 @@ function pop_box_new(value, Width, Height){ $(document.body).append(container); $("#popupWrap").html(value); $("#popupWrap").show(); - $('#popupWrap').css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed","z-index":"99999"}); + $('#popupWrap').css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed","z-index":"99999","background-color":"#fff","box-shadow": "0px 2px 8px rgba(146, 153, 169, 0.5)"}); $('#popupWrap').find("a[class*='close']").click(function(){ $("#popupWrap").hide(); }); diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index d819df280..fdcea23f3 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -1441,8 +1441,8 @@ a.syllabusbox_a_blue { /*flex布局*/ .flex-container {display:flex;} -.flex-cell {flex:1;} -.flex-cell:last-child {text-align:right;} +.flex-cell {flex:1; text-align: center} +/*.flex-cell:last-child {text-align:right;}*/ /*新课程、项目公用样式提取*/ .sy_new_orange{font-size: 12px;padding: 0 5px;border-radius: 3px;line-height: 14px;color: #ff4a1b;border: 1px solid #ff4a1b;}