From 157cf4262f3ccc4ea2b3f95b3a46d1b6f8dafe36 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 31 Oct 2016 10:41:00 +0800 Subject: [PATCH 01/42] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=AD=94=E9=A2=98=E7=BB=93=E6=9E=9C=E6=97=B6?= =?UTF-8?q?=E6=8C=89=E9=A2=98=E5=8F=B7=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 2 +- app/views/poll/_show_MCQ_result.html.erb | 12 +++++ app/views/poll/_show_MC_result.html.erb | 1 + app/views/poll/_show_mulit_result.html.erb | 1 + app/views/poll/_show_single_result.html.erb | 1 + app/views/poll/poll_result.html.erb | 57 ++++++--------------- 6 files changed, 31 insertions(+), 43 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 263ffbaa5..08e221d5e 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -521,7 +521,7 @@ class PollController < ApplicationController #显示某个学生某份问卷的填写结果 def poll_result - @poll_questions = paginateHelper @poll.poll_questions,5 + @poll_questions = @poll.poll_questions @left_nav_type = 7 respond_to do |format| format.html{render :layout => 'base_courses'} diff --git a/app/views/poll/_show_MCQ_result.html.erb b/app/views/poll/_show_MCQ_result.html.erb index 4129f164b..0a5f79e2e 100644 --- a/app/views/poll/_show_MCQ_result.html.erb +++ b/app/views/poll/_show_MCQ_result.html.erb @@ -2,9 +2,21 @@
第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [多选题] <%if poll_question.is_necessary == 1%> * <%end%> + <% if poll_question.min_choices != 0 || poll_question.max_choices != 0 %> +

+ <% if poll_question.min_choices != 0 && poll_question.max_choices != 0 %> + 答题时最少选<%=poll_question.min_choices %>项、最多选<%=poll_question.max_choices %>项 + <% elsif poll_question.min_choices != 0 %> + 答题时最少选<%=poll_question.min_choices %>项 + <% elsif poll_question.max_choices != 0 %> + 答题时最多选<%=poll_question.max_choices %>项 + <% end %> +

+ <% end %>
diff --git a/app/views/poll/_show_MC_result.html.erb b/app/views/poll/_show_MC_result.html.erb index d154468b3..141702f36 100644 --- a/app/views/poll/_show_MC_result.html.erb +++ b/app/views/poll/_show_MC_result.html.erb @@ -2,6 +2,7 @@
第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [单选题] <%if poll_question.is_necessary == 1%> * <%end%> diff --git a/app/views/poll/_show_mulit_result.html.erb b/app/views/poll/_show_mulit_result.html.erb index da72ea35d..14ba41d5b 100644 --- a/app/views/poll/_show_mulit_result.html.erb +++ b/app/views/poll/_show_mulit_result.html.erb @@ -2,6 +2,7 @@
第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [多行主观题] <%if poll_question.is_necessary == 1%> * <%end%> diff --git a/app/views/poll/_show_single_result.html.erb b/app/views/poll/_show_single_result.html.erb index 4fbf3698f..c5fcd4ed4 100644 --- a/app/views/poll/_show_single_result.html.erb +++ b/app/views/poll/_show_single_result.html.erb @@ -2,6 +2,7 @@
第<%= poll_question.question_number%>题: <%= poll_question.question_title %> + [主观题] <%if poll_question.is_necessary == 1%> * <%end%> diff --git a/app/views/poll/poll_result.html.erb b/app/views/poll/poll_result.html.erb index bb9aa7f63..59096fd8c 100644 --- a/app/views/poll/poll_result.html.erb +++ b/app/views/poll/poll_result.html.erb @@ -7,50 +7,23 @@
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
- <% mc_question_list = @poll.poll_questions.where("question_type=1") %> - <% mcq_question_list = @poll.poll_questions.where("question_type=2") %> - <% single_question_list = @poll.poll_questions.where("question_type=3") %> - <% multi_question_list = @poll.poll_questions.where("question_type=4") %> -
"> -

单选题

- <% mc_question_list.each do |poll_question| %> -
-
- <%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %> + <% @poll_questions.each do |poll_question|%> +
+
+
+ <% if poll_question.question_type == 1%> + <%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %> + <% elsif poll_question.question_type == 2%> + <%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %> + <% elsif poll_question.question_type == 3%> + <%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %> + <% elsif poll_question.question_type == 4%> + <%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %> + <% end%> +
- <% end %> -
-
"> -

多选题

- <% mcq_question_list.each do |poll_question| %> -
-
- <%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %> -
-
- <% end %> -
-
"> -

单行主观题

- <% single_question_list.each do |poll_question| %> -
-
- <%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %> -
-
- <% end %> -
-
"> -

多行主观题

- <% multi_question_list.each do |poll_question| %> -
-
- <%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %> -
-
- <% end %> -
+ <% end%>
From 936f610102f47664d88e498de710bbef79a7e80e Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 31 Oct 2016 15:35:29 +0800 Subject: [PATCH 02/42] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=90=8E=E7=BB=84=E9=95=BF=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=88=90=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_add_or_delete_member.html.erb | 129 ++++++++++++++++++ .../student_work/_student_work_list.html.erb | 14 +- 2 files changed, 136 insertions(+), 7 deletions(-) create mode 100644 app/views/student_work/_add_or_delete_member.html.erb diff --git a/app/views/student_work/_add_or_delete_member.html.erb b/app/views/student_work/_add_or_delete_member.html.erb new file mode 100644 index 000000000..56682ea9e --- /dev/null +++ b/app/views/student_work/_add_or_delete_member.html.erb @@ -0,0 +1,129 @@ +<% if homework.homework_detail_group %> +
+
+
请从<%= homework.homework_detail_group.base_on_project == 1 ? '项目成员':'课程成员' %>中添加小组成员
+
+
+
+
+ +
+
+
    +
    +
      +
    • <%=User.current.show_name %> + <% unless User.current.user_extensions.student_id == "" %> + (<%=User.current.user_extensions.student_id %>) + <% end %> +
    • +
    +
    + + +
    +
    + +<% end %> \ No newline at end of file diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index 66911d15f..fb72a42ab 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -31,11 +31,11 @@ <%= link_to "代码查重", work_canrepeat_student_work_index_path(homework:@homework.id, course_id:@course.id), class: 'BlueCirBtn fl',:remote => true %> <% end %> <% end%> - <%# if @homework.homework_type == 3 && my_work && my_work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") %> - - - - <%# end %> + <% if @homework.homework_type == 3 && my_work && my_work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") %> + + <% end %> <% if @is_teacher && @homework.homework_type == 3 %>
    @@ -110,7 +110,7 @@ }); function add_or_delete_group_member() { - var html_value = "<%#= escape_javascript(render :partial => 'student_work/add_or_delete_member',:locals => {:homework=>@homework,:edit_mode => true}) %>"; - pop_up_box(html_value, 528); + var html_value = "<%= escape_javascript(render :partial => 'student_work/add_or_delete_member',:locals => {:homework=>@homework,:edit_mode => true}) %>"; + pop_up_box(html_value, 530); } \ No newline at end of file From ec45ee89d9ff82173b381f85afdc370fc8f7b99d Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 1 Nov 2016 15:59:00 +0800 Subject: [PATCH 03/42] =?UTF-8?q?=E5=B7=B2=E6=88=AA=E6=AD=A2=E7=9A=84?= =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A=EF=BC=9A=E7=BB=84=E9=95=BF?= =?UTF-8?q?=E5=8F=AF=E7=BC=96=E8=BE=91=E6=88=90=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 36 +++++++- .../_add_or_delete_member.html.erb | 84 +++++++++++-------- .../student_work/_student_work_list.html.erb | 2 +- .../search_course_students.js.erb | 2 +- config/routes.rb | 1 + 5 files changed, 86 insertions(+), 39 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index d6300c6bf..51375b5f3 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -5,7 +5,9 @@ class StudentWorkController < ApplicationController include ApplicationHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students,:work_canrepeat] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex, + :set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project, + :search_course_students,:work_canrepeat,:add_group_member] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment] before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] @@ -1149,6 +1151,38 @@ class StudentWorkController < ApplicationController render :json => req end + #作业截止后组长添加成员 + def add_group_member + student_work = @homework.student_works.where("user_id = #{User.current.id}").first + if params[:member_id] + for i in 1 .. params[:member_id].count do + work = StudentWork.find_by_homework_common_id_and_user_id(@homework.id, params[:member_id][i].to_i) + unless work + stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description,:user_id =>params[:member_id][i].to_i, :homework_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => Time.now) + if stu_work.save + stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => params[:member_id][i].to_i, :is_leader => 0) + stu_project.save + end + end + end + student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",student_work.id,0) + student_work_projects.each do |sp| + unless params[:member_id].include?(sp.user_id.to_s) + work = StudentWork.where("homework_common_id = #{@homework.id} and user_id = #{sp.user_id}").first + sp.destroy + if work + work.destroy + end + end + end + end + respond_to do |format| + format.html { + redirect_to student_work_index_url(:homework => @homework.id, :tab => 2) + } + end + end + private def searchstudent_by_name users, name mems = [] diff --git a/app/views/student_work/_add_or_delete_member.html.erb b/app/views/student_work/_add_or_delete_member.html.erb index 56682ea9e..f52898be6 100644 --- a/app/views/student_work/_add_or_delete_member.html.erb +++ b/app/views/student_work/_add_or_delete_member.html.erb @@ -9,6 +9,15 @@
    +
    + <%=form_tag(add_group_member_student_work_index_path(:homework => homework.id), :method => :post, :id => 'add_group_member_form') do %> + <% str = User.current.id.to_s%> + <% student_work = StudentWork.where("homework_common_id = #{homework.id} and user_id = #{User.current.id}").first %> + <% student_work.student_work_projects.where("is_leader = ?", 0).each do |pro| %> + <% str += ','+pro.user_id.to_s %> + <% end %> + + <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %>
        @@ -16,12 +25,15 @@ <% unless User.current.user_extensions.student_id == "" %> (<%=User.current.user_extensions.student_id %>) <% end %> +
      - - + + +
      + <% end %>
      \ No newline at end of file diff --git a/app/views/homework_common/set_evaluation_attr.js.erb b/app/views/homework_common/set_evaluation_attr.js.erb index e084967c7..672520ad7 100644 --- a/app/views/homework_common/set_evaluation_attr.js.erb +++ b/app/views/homework_common/set_evaluation_attr.js.erb @@ -1,4 +1,4 @@ -clickCanel(); +hideModal(); <% if @hw_status == 5 %> $("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>"); <% else %> diff --git a/app/views/homework_common/start_evaluation_set.js.erb b/app/views/homework_common/start_evaluation_set.js.erb index 3ece646dc..d038a0a89 100644 --- a/app/views/homework_common/start_evaluation_set.js.erb +++ b/app/views/homework_common/start_evaluation_set.js.erb @@ -1,10 +1,12 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>'); +var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>"; +pop_box_new(htmlvalue, 620, 315); +//$('#ajax-modal').html('<%#= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>'); var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; -showModal('ajax-modal', '350px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + -""); -$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); +//showModal('ajax-modal', '350px'); +//$('#ajax-modal').siblings().remove(); +//$('#ajax-modal').before("" + +//""); +//$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); $(function() { $('#evaluation_start_time').datepicker(datepickerOptions); $('#evaluation_end_time').datepicker(datepickerOptions); }); \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index ec8263d6f..47d6266b4 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -423,6 +423,9 @@ function showModal(id, width) { } function hideModal(el) { + if($("#popupWrap").length > 0){ + $("#popupWrap").hide(); + } var modal; if (el) { modal = $(el).parents('.ui-dialog-content'); @@ -1554,13 +1557,24 @@ function pop_up_box(value,tWidth,tTop,tLeft){ function pop_box_new(value, Width, Height){ w = ($(window).width() - Width)/2; h = ($(window).height() - Height)/2; - $("#ajax-modal").html(value); - showModal('ajax-modal', Width + 'px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').parent().css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed"}); - $('#ajax-modal').parent().removeClass("resourceUploadPopup popbox_polls popbox"); - $('#ajax-modal').css({"padding":"0","overflow":"hidden"}); - $('#ajax-modal').parent().attr("id","popupWrap"); + var container =$('
      '); + container.attr('id','popupWrap'); + $(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').find("a[class*='close']").click(function(){ + $("#popupWrap").hide(); + }); +// w = ($(window).width() - Width)/2; +// h = ($(window).height() - Height)/2; +// $("#ajax-modal").html(value); +// showModal('ajax-modal', Width + 'px'); +// $('#ajax-modal').siblings().remove(); +// $('#ajax-modal').parent().css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed"}); +// $('#ajax-modal').parent().removeClass("resourceUploadPopup popbox_polls popbox"); +// $('#ajax-modal').css({"padding":"0","overflow":"hidden"}); +// $('#ajax-modal').parent().attr("id","popupWrap"); //拖拽 function Drag(id) { @@ -1576,7 +1590,7 @@ function pop_box_new(value, Width, Height){ _this.getDistance(evt); document.onmousemove = function (evt) { _this.setPosition(evt); - } + }; _this.div.onmouseup = function () { _this.clearEvent(); } @@ -1586,7 +1600,7 @@ function pop_box_new(value, Width, Height){ var oEvent = evt || event; this.disX = oEvent.clientX - this.div.offsetLeft; this.disY = oEvent.clientY - this.div.offsetTop; - } + }; Drag.prototype.setPosition = function (evt) { var oEvent = evt || event; var l = oEvent.clientX - this.disX; @@ -1605,18 +1619,24 @@ function pop_box_new(value, Width, Height){ } this.div.style.left = l + "px"; this.div.style.top = t + "px"; - } + }; Drag.prototype.clearEvent = function () { this.div.onmouseup = null; document.onmousemove = null; - } + }; - $(".sy_popup_con").mousedown(function(event){ + new Drag("popupWrap"); + + $("#popupWrap input, #popupWrap textarea").mousedown(function(event){ event.stopPropagation(); new Drag("popupWrap"); }); } +function close_modal(){ + $("#popupWrap").hide(); +} + // 公共提示弹框样式 //function pop_box_tip_new(value, Width, Top, Left){ // $("#ajax-modal").html(value); diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 71e817e9f..13d93a3be 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -650,7 +650,7 @@ function submit_set_evaluation_attr(end_time){ $("#evaluation_num").focus(); } else{ - $('#popbox02 form').submit(); + $('#muban_popup_box form').submit(); } } diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index b005945d5..c9ecc48fd 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -165,6 +165,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .mr60 {margin-right:60px;} .mr65 {margin-right:65px;} .mr70{margin-right: 70px;} +.mr80{margin-right: 80px;} .mr95 {margin-right:95px !important;} .mr100 {margin-right:100px !important;} .mr118 {margin-right:118px !important;} diff --git a/public/stylesheets/css/moduel.css b/public/stylesheets/css/moduel.css index 1e2250de8..9c6d0d333 100644 --- a/public/stylesheets/css/moduel.css +++ b/public/stylesheets/css/moduel.css @@ -3,7 +3,10 @@ .muban_popup_top{background:#3b94d6;height:40px;-webkit-border-radius: 5px 5px 0px 0px;-moz-border-radius: 5px 5px 0px 0px;-o-border-radius: 5px 5px 0px 0px;border-radius: 5px 5px 0px 0px;} .muban_popup_top h3{ font-size:16px; color:#fff; font-weight:normal; line-height:40px; padding-left:10px; } a.muban_icons_close{width:20px; height:20px;display:block;background: url(/images/sy/sy_icons_close.png) 0 0px no-repeat; margin:8px 10px 0 0;} -a:hover.muban_icons_close{background: url(/images/sy/sy_icons_close.png) -40px 0px no-repeat;} +a:hover.muban_icons_close{background: url(../images/sy/sy_icons_close.png) -40px 0px no-repeat;} +#muban_popup_box input,#muban_popup_box select{ border:1px solid #c8c8c8; height: 28px; color: #888;} +#muban_popup_box label.pop_box_label{width: 100px; text-align: right; display: inline-block;} +input.radio-width90{ width: 90px; } /*模板表格 20161013byLB*/ .muban_table{ width:100%; background:#fff; border:1px solid #e5e5e5; border-bottom: none; } .muban_table thead tr{ height:40px; line-height:40px;} @@ -57,3 +60,11 @@ a.sub_btn{ cursor:pointer; -moz-border-radius:3px; -webkit-border-radius:3px; b a:hover.sub_btn{ background:#b5e2fa; color:#000; border:1px solid #3c7fb1;} /*模板form 20161013byLB*/ textarea.muban_textarea{ width: 98.5%;border:1px solid #ddd; background:#fff; color:#666; padding:5px;} +/*模板图标20161020byLB*/ +.muban-icons-clock{ background: url("../images/project/icons_issue.png") 0 -224px no-repeat; display: inline-block; width: 19px; height: 13px;} +/*提示条20161020byLB*/ +.alert{ padding:10px;border: 1px solid transparent; text-align: center;} +.alert-blue{ background-color: #d9edf7;border-color: #bce8f1; color: #3a87ad;} +.alert-orange{ background-color: #fff9e9;border-color: #f6d0b1; color:#ee4a20;} +.close{padding: 0;cursor: pointer; background: transparent; border: 0; -webkit-appearance: none; font-size: 21px; font-weight: bold;line-height: 1; color: #000000; text-shadow: 0 1px 0 #ffffff; opacity: 0.3;} +.close:hover{opacity: 0.5;} \ No newline at end of file diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index 33db41ad9..d819df280 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -1518,3 +1518,8 @@ a.syllabusbox_a_blue{ .homepagePostContainer {width:718px; border:1px solid #dddddd; padding:15px; background-color:#ffffff;} .homepageMainContent {margin: 10px auto; width: 750px;} + +.pro_newsetting_con li{ line-height: 30px;} +.popup_tip_box { position: relative; padding: 5px 10px; white-space: nowrap; background-color: #FFFEF4; border:1px solid #F3DDB3;} +.popup_tip_box em { display: block; border-width: 9px; position: absolute; top: 5px; left: -18px; border-style: dashed solid dashed dashed; border-color: transparent #F3DDB3 transparent transparent; font-size: 0; line-height: 0;} +.popup_tip_box span { display: block; border-width: 9px;position: absolute; top: 5px; left: -17px; border-style: dashed solid dashed dashed;border-color: transparent #FFFEF4 transparent transparent; font-size: 0; line-height: 0; } \ No newline at end of file From ecae60054641d9525b8a7c0e1bf332c66fda7bb4 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 2 Nov 2016 16:46:47 +0800 Subject: [PATCH 10/42] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E3=80=81=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84=E7=9A=84=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 46 +++++++------- .../homework_common/_alert_anonyoms.html.erb | 60 +++++++------------ .../alert_anonymous_comment.js.erb | 8 +-- .../start_evaluation_set.js.erb | 8 +-- app/views/layouts/new_base_user.html.erb | 2 +- .../_add_or_delete_member.html.erb | 6 +- lib/tasks/homework_evaluation.rake | 38 ++++++------ public/javascripts/new_user.js | 2 +- public/javascripts/organization.js | 2 +- 9 files changed, 73 insertions(+), 99 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index a0735bf8a..7b510ec91 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -202,24 +202,24 @@ class HomeworkCommonController < ApplicationController if @homework_detail_manual.comment_status == 1 student_works = @homework.student_works.has_committed if student_works && student_works.size >= 2 - # if @homework.homework_type == 3 - # student_work_projects = @homework.student_work_projects.where("student_work_id is not null") - # student_work_projects.each_with_index do |pro_work, pro_index| - # n = @homework_detail_manual.evaluation_num - # n = n < student_works.size ? n : student_works.size - 1 - # work_index = -1 - # student_works.each_with_index do |stu_work, stu_index| - # if stu_work.id.to_i == pro_work.student_work_id.to_i - # work_index = stu_index - # end - # end - # assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) - # assigned_homeworks.each do |h| - # student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) - # student_works_evaluation_distributions.save - # end - # end - # else + if @homework.homework_type == 3 + student_work_projects = @homework.student_work_projects.where("student_work_id is not null") + student_work_projects.each_with_index do |pro_work, pro_index| + n = @homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + work_index = -1 + student_works.each_with_index do |stu_work, stu_index| + if stu_work.id.to_i == pro_work.student_work_id.to_i + work_index = stu_index + end + end + assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + else student_works.each_with_index do |work, index| user = work.user n = @homework_detail_manual.evaluation_num @@ -230,7 +230,7 @@ class HomeworkCommonController < ApplicationController student_works_evaluation_distributions.save end end - #end + end @homework_detail_manual.update_column('comment_status', 2) @homework_detail_manual.update_column('evaluation_start', Date.today) @statue = 1 @@ -300,13 +300,15 @@ class HomeworkCommonController < ApplicationController def alert_anonymous_comment @cur_size = 0 @totle_size = 0 + @work_size = 0 if @homework_detail_manual.comment_status == 1 @totle_size = @course.student.count - @cur_size = @homework.student_works.has_committed.size + @cur_size = @homework.student_works.where("work_status != 0").size + @work_size = @homework.student_works.has_committed.size elsif @homework_detail_manual.comment_status == 2 - @homework.student_works.has_committed.map { |work| @totle_size += work.student_works_evaluation_distributions.count} + @homework.student_works.where("work_status != 0").map { |work| @totle_size += work.student_works_evaluation_distributions.count} @cur_size = 0 - @homework.student_works.has_committed.map { |work| @cur_size += work.student_works_scores.select("distinct user_id").where(:reviewer_role => 3).count} + @homework.student_works.where("work_status != 0").map { |work| @cur_size += work.student_works_scores.select("distinct user_id").where(:reviewer_role => 3).count} end @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) @user_activity_id = params[:user_activity_id].to_i diff --git a/app/views/homework_common/_alert_anonyoms.html.erb b/app/views/homework_common/_alert_anonyoms.html.erb index 8834d6746..9b3e054ac 100644 --- a/app/views/homework_common/_alert_anonyoms.html.erb +++ b/app/views/homework_common/_alert_anonyoms.html.erb @@ -1,44 +1,24 @@ -
      -
      +
      +
      +

      + <% if @homework_detail_manual.comment_status == 1%> + 启动匿评提示 + <% elsif @homework_detail_manual.comment_status == 2 %> + 关闭匿评提示 + <% end %> +

      + +
      +
      +
      <% if @homework_detail_manual.comment_status == 1%> -

      开启匿评功能

      -

      - 开启匿评后提交的作品将 - 不能参与匿评, - 匿评评分将被记为 - 0分 - 。目前有 - <%= @totle_size%>个 - 学生,共提交了 - <%= @cur_size %> - 份作品,占 - <%= @percent %>%, - 是否确定开启匿评? -

      - <% elsif @homework_detail_manual.comment_status == 2 %> -

      关闭匿评功能

      -

      - 关闭匿评后学生将不能对作品进行 - 匿评 - ,且作品列表将会 - 公开, - 目前分配了 - <%= @totle_size%>份 - 匿评作品,已评了 - <%= @cur_size %> - 份作品,占 - <%= @percent %>%, - 是否确定关闭匿评? -

      +

      开启匿评之后提交作品的学生及其作品,不能参与匿评,匿评评分将被记为 0 分。

      +

      本次作业共 <%= @totle_size %>个 学生,已有 <%= @cur_size %>个 学生共提交了 <%= @work_size %> 份作品,占 <%= @percent %>%,是否确定开启匿评?

      + <% elsif @homework_detail_manual.comment_status == 2 %> +

      关闭匿评后学生将不能对作品进行匿评,且作品列表将会公开,

      +

      目前分配了 <%= @totle_size %>份 匿评作品,已评了 <%= @cur_size %>份 作品,占 <%= @percent %>%,是否确定关闭匿评?

      <% end %> - + 确定 + 取消
      - diff --git a/app/views/homework_common/alert_anonymous_comment.js.erb b/app/views/homework_common/alert_anonymous_comment.js.erb index 96e958648..ed89ec933 100644 --- a/app/views/homework_common/alert_anonymous_comment.js.erb +++ b/app/views/homework_common/alert_anonymous_comment.js.erb @@ -1,6 +1,2 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>'); -showModal('ajax-modal', '500px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + -""); -$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file +var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/alert_anonyoms') %>"; +pop_box_new(htmlvalue, 550, 171); \ No newline at end of file diff --git a/app/views/homework_common/start_evaluation_set.js.erb b/app/views/homework_common/start_evaluation_set.js.erb index d038a0a89..24ecbd340 100644 --- a/app/views/homework_common/start_evaluation_set.js.erb +++ b/app/views/homework_common/start_evaluation_set.js.erb @@ -1,12 +1,6 @@ var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>"; -pop_box_new(htmlvalue, 620, 315); -//$('#ajax-modal').html('<%#= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>'); +pop_box_new(htmlvalue, 550, 315); var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; -//showModal('ajax-modal', '350px'); -//$('#ajax-modal').siblings().remove(); -//$('#ajax-modal').before("" + -//""); -//$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); $(function() { $('#evaluation_start_time').datepicker(datepickerOptions); $('#evaluation_end_time').datepicker(datepickerOptions); }); \ No newline at end of file diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 3ed28f418..efa38734e 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -7,7 +7,7 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus',:media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel',:media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%> diff --git a/app/views/student_work/_add_or_delete_member.html.erb b/app/views/student_work/_add_or_delete_member.html.erb index 3477b972a..d21a91da5 100644 --- a/app/views/student_work/_add_or_delete_member.html.erb +++ b/app/views/student_work/_add_or_delete_member.html.erb @@ -13,8 +13,10 @@ <%=form_tag(add_group_member_student_work_index_path(:homework => homework.id), :method => :post, :id => 'add_group_member_form') do %> <% str = User.current.id.to_s%> <% student_work = StudentWork.where("homework_common_id = #{homework.id} and user_id = #{User.current.id}").first %> - <% student_work.student_work_projects.where("is_leader = ?", 0).each do |pro| %> - <% str += ','+pro.user_id.to_s %> + <% if student_work %> + <% student_work.student_work_projects.where("is_leader = ?", 0).each do |pro| %> + <% str += ','+pro.user_id.to_s %> + <% end %> <% end %> <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %> diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index dc0dec270..e53e974ff 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -16,24 +16,24 @@ namespace :homework_evaluation do if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评 student_works = homework_common.student_works.has_committed if student_works && student_works.size >= 2 - # if homework_common.homework_type == 3 - # student_work_projects = homework_common.student_work_projects.where("student_work_id is not null") - # student_work_projects.each_with_index do |pro_work, pro_index| - # n = homework_detail_manual.evaluation_num - # n = n < student_works.size ? n : student_works.size - 1 - # work_index = -1 - # student_works.each_with_index do |stu_work, stu_index| - # if stu_work.id.to_i == pro_work.student_work_id.to_i - # work_index = stu_index - # end - # end - # assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) - # assigned_homeworks.each do |h| - # student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) - # student_works_evaluation_distributions.save - # end - # end - # else + if homework_common.homework_type == 3 + student_work_projects = homework_common.student_work_projects.where("student_work_id is not null") + student_work_projects.each_with_index do |pro_work, pro_index| + n = homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + work_index = -1 + student_works.each_with_index do |stu_work, stu_index| + if stu_work.id.to_i == pro_work.student_work_id.to_i + work_index = stu_index + end + end + assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + else student_works.each_with_index do |work, index| user = work.user n = homework_detail_manual.evaluation_num @@ -44,7 +44,7 @@ namespace :homework_evaluation do student_works_evaluation_distributions.save end end - #end + end homework_detail_manual.update_column('comment_status', 2) # 匿评开启消息邮件通知,# 所有人 #send_message_anonymous_comment(homework_common, 2) diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index 314850332..9282365d4 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -268,7 +268,7 @@ function submit_set_evaluation_attr(end_time){ $("#evaluation_num").focus(); } else{ - $('#popbox02 form').submit(); + $('#muban_popup_box form').submit(); } } diff --git a/public/javascripts/organization.js b/public/javascripts/organization.js index 7c1f3578c..726e3c449 100644 --- a/public/javascripts/organization.js +++ b/public/javascripts/organization.js @@ -50,7 +50,7 @@ function reset_topic(){ $("#evaluation_num").focus(); } else{ - $('#popbox02 form').submit(); + $('#muban_popup_box form').submit(); hideModal(); } } From 7d81a5230871201b21158249c690f2634e44022b Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 3 Nov 2016 10:16:34 +0800 Subject: [PATCH 11/42] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=97=B6=E5=80=99?= =?UTF-8?q?=E5=8A=A0=E7=82=B9=E6=97=A5=E5=BF=97=E8=B0=83=E8=AF=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 9 +++++++++ app/helpers/account_helper.rb | 7 +++++++ app/services/users_service.rb | 10 ++++++++++ 3 files changed, 26 insertions(+) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 02dfe9a45..fcc4c58d6 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -139,7 +139,12 @@ class AccountController < ApplicationController end else us = UsersService.new + tStarttime = Time.now @user = us.register user_params.merge(:should_confirmation_password => true) + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "register_1 wait time = #{tUsedtime} ms" + case Setting.self_registration when '1' #register_by_email_activation(@user) @@ -149,9 +154,13 @@ class AccountController < ApplicationController end when '3' #register_automatically(@user) + tStarttime = Time.now if !@user.new_record? self.logged_user = @user flash[:notice] = l(:notice_account_activated) + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "register_2 wait time = #{tUsedtime} ms" redirect_to my_account_url(:tip=>1) else redirect_to signin_path diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index 827557a40..00b12d6f7 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -33,10 +33,14 @@ module AccountHelper end def automatically_register(user, &block) + tStarttime = Time.now # Automatic activation user.activate user.last_login_on = Time.now if user.save + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "register_130 wait time = #{tUsedtime} ms" UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) #self.logged_user = user #flash[:notice] = l(:notice_account_activated) @@ -44,6 +48,9 @@ module AccountHelper else yield if block_given? end + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "register_131 wait time = #{tUsedtime} ms" user end diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 540e1bbff..95e56d325 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -11,6 +11,8 @@ class UsersService #成功返回注册后的User实例,失败直接抛异常 def register(params) + Rails.logger.info "register_11" + Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000 @user = User.new @user.admin = false @user.register @@ -19,6 +21,8 @@ class UsersService password = params[:password] password_confirmation = params[:password_confirmation] should_confirmation_password = params[:should_confirmation_password] + Rails.logger.info "register_12" + Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000 if !password.blank? && !password_confirmation.blank? && should_confirmation_password @user.password, @user.password_confirmation = password, password_confirmation elsif !password.blank? && !should_confirmation_password @@ -26,6 +30,8 @@ class UsersService else @user.password = "" end + Rails.logger.info "register_13" + Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000 case Setting.self_registration when '1' @user = email_activation_register(@user) @@ -34,11 +40,15 @@ class UsersService else @user = administrator_manually__register(@user) end + Rails.logger.info "register_14" + Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000 if @user.id != nil ue = @user.user_extensions ||= UserExtensions.new ue.user_id = @user.id ue.save end + Rails.logger.info "register_15" + Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000 @user #img_url = url_to_avatar(@user) #gender = @user.user_extensions.gender.nil? ? 0 : @user.user_extensions.gender From 8bf6ef437120b72c6b4aa073a2231e02808f96b1 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 3 Nov 2016 10:21:41 +0800 Subject: [PATCH 12/42] . --- app/helpers/account_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index 00b12d6f7..b490c6a51 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -40,7 +40,7 @@ module AccountHelper if user.save tEndtime = Time.now tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "register_130 wait time = #{tUsedtime} ms" + Rails.logger.info "register_130 wait time = #{tUsedtime} ms" UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) #self.logged_user = user #flash[:notice] = l(:notice_account_activated) @@ -50,7 +50,7 @@ module AccountHelper end tEndtime = Time.now tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "register_131 wait time = #{tUsedtime} ms" + Rails.logger.info "register_131 wait time = #{tUsedtime} ms" user end From 4575b8274e46d90f8bc240894f1c33e76bfabcf0 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 3 Nov 2016 10:25:53 +0800 Subject: [PATCH 13/42] =?UTF-8?q?=E4=B8=8D=E9=99=90=E5=AE=9A=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 4 ++-- app/helpers/application_helper.rb | 2 +- lib/tasks/homework_evaluation.rake | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 7b510ec91..1d8fd7466 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -206,7 +206,7 @@ class HomeworkCommonController < ApplicationController student_work_projects = @homework.student_work_projects.where("student_work_id is not null") student_work_projects.each_with_index do |pro_work, pro_index| n = @homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 work_index = -1 student_works.each_with_index do |stu_work, stu_index| if stu_work.id.to_i == pro_work.student_work_id.to_i @@ -223,7 +223,7 @@ class HomeworkCommonController < ApplicationController student_works.each_with_index do |work, index| user = work.user n = @homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 assigned_homeworks = get_assigned_homeworks(student_works, n, index) assigned_homeworks.each do |h| student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6a1c00ae6..933748ea0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2854,7 +2854,7 @@ module ApplicationHelper link_to "补交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_red' end else - if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 && work.user_id == User.current.id #匿评作业,且作业状态不是在开启匿评之前 + if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前 link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品" elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束" diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index e53e974ff..087c6183c 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -20,7 +20,7 @@ namespace :homework_evaluation do student_work_projects = homework_common.student_work_projects.where("student_work_id is not null") student_work_projects.each_with_index do |pro_work, pro_index| n = homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 work_index = -1 student_works.each_with_index do |stu_work, stu_index| if stu_work.id.to_i == pro_work.student_work_id.to_i @@ -37,7 +37,7 @@ namespace :homework_evaluation do student_works.each_with_index do |work, index| user = work.user n = homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 assigned_homeworks = get_assigned_homeworks(student_works, n, index) assigned_homeworks.each do |h| student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) From a075b6d237d0d913c90d690802a22b04484e42df Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 3 Nov 2016 10:41:51 +0800 Subject: [PATCH 14/42] =?UTF-8?q?.=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/account_helper.rb | 7 +++++-- app/models/user.rb | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index b490c6a51..fd10c06a4 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -37,10 +37,13 @@ module AccountHelper # Automatic activation user.activate user.last_login_on = Time.now + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + Rails.logger.info "register_130 wait time = #{tUsedtime} ms" if user.save tEndtime = Time.now tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "register_130 wait time = #{tUsedtime} ms" + Rails.logger.info "register_131 wait time = #{tUsedtime} ms" UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) #self.logged_user = user #flash[:notice] = l(:notice_account_activated) @@ -50,7 +53,7 @@ module AccountHelper end tEndtime = Time.now tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "register_131 wait time = #{tUsedtime} ms" + Rails.logger.info "register_132 wait time = #{tUsedtime} ms" user end diff --git a/app/models/user.rb b/app/models/user.rb index 0bcd04f26..65eb1992c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -488,9 +488,13 @@ class User < Principal def update_hashed_password # update hashed_password if password was set + tStarttime = Time.now if self.password && self.auth_source_id.blank? salt_password(password) end + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + Rails.logger.info "update_hashed_password wait time = #{tUsedtime} ms" end alias :base_reload :reload @@ -1287,9 +1291,13 @@ class User < Principal end end def update_user_ealasticsearch_index + tStarttime = Time.now if self.id != 2 && self.id != 4 self.__elasticsearch__.update_document if Rails.env.production? end + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + Rails.logger.info "update_elastic wait time = #{tUsedtime} ms" end def delete_user_ealasticsearch_index if self.id != 2 && self.id != 4 From 4451ac80a01b81e9373d4fe6118c18c6c647aec7 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 3 Nov 2016 10:53:55 +0800 Subject: [PATCH 15/42] . --- app/models/user.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index 65eb1992c..d65b661d8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1197,18 +1197,27 @@ class User < Principal #用户动态公共表记录 def act_as_principal_activity + tStarttime = Time.now self.principal_acts << PrincipalActivity.new(:user_id => self.id,:principal_id => self.id) + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + Rails.logger.info "act_as_principal_activity wait time = #{tUsedtime} ms" end # 注册用户的时候消息默认点击时间为用户创建时间 def add_onclick_time + tStarttime = Time.now if OnclickTime.where("user_id =?" , self.id).first.nil? OnclickTime.create(:user_id => self.id, :onclick_time => self.created_on) end + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + Rails.logger.info "add_onclick_time wait time = #{tUsedtime} ms" end #为新注册用户发送留言 def add_new_jour + tStarttime = Time.now if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0" if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any? lead_message1 = Message.find(19292) @@ -1223,6 +1232,9 @@ class User < Principal self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) end end + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + Rails.logger.info "add_new_jour wait time = #{tUsedtime} ms" end # 更新邮箱的同事,更新invite_lists表中的邮箱信息 @@ -1286,9 +1298,13 @@ class User < Principal def create_user_ealasticsearch_index + tStarttime = Time.now if self.id != 2 && self.id != 4 self.__elasticsearch__.index_document if Rails.env.production? end + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + Rails.logger.info "create_user_ealasticsearch_index wait time = #{tUsedtime} ms" end def update_user_ealasticsearch_index tStarttime = Time.now From 08e9b8d56333314f3dbb417266aa365bcfbde72a Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 3 Nov 2016 11:11:52 +0800 Subject: [PATCH 16/42] . --- app/models/user.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index d65b661d8..5e37e84fd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1219,6 +1219,9 @@ class User < Principal def add_new_jour tStarttime = Time.now if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0" + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + Rails.logger.info "add_new_jour_1 wait time = #{tUsedtime} ms" if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any? lead_message1 = Message.find(19292) notes1 = lead_message1.content @@ -1227,14 +1230,20 @@ class User < Principal lead_message3 = Message.find(19504) notes3 = lead_message3.content #user_id 默认为课程使者创建 + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + Rails.logger.info "add_new_jour_2 wait time = #{tUsedtime} ms" self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0) self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0) self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + Rails.logger.info "add_new_jour_3 wait time = #{tUsedtime} ms" end end tEndtime = Time.now tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "add_new_jour wait time = #{tUsedtime} ms" + Rails.logger.info "add_new_jour_4 wait time = #{tUsedtime} ms" end # 更新邮箱的同事,更新invite_lists表中的邮箱信息 From 7064e5b4138c8a9abf4f60adf0a99dabbef01078 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 3 Nov 2016 11:19:00 +0800 Subject: [PATCH 17/42] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 9 ------ app/helpers/account_helper.rb | 10 ------- app/models/user.rb | 41 +++++---------------------- app/services/users_service.rb | 10 ------- 4 files changed, 7 insertions(+), 63 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index fcc4c58d6..02dfe9a45 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -139,12 +139,7 @@ class AccountController < ApplicationController end else us = UsersService.new - tStarttime = Time.now @user = us.register user_params.merge(:should_confirmation_password => true) - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "register_1 wait time = #{tUsedtime} ms" - case Setting.self_registration when '1' #register_by_email_activation(@user) @@ -154,13 +149,9 @@ class AccountController < ApplicationController end when '3' #register_automatically(@user) - tStarttime = Time.now if !@user.new_record? self.logged_user = @user flash[:notice] = l(:notice_account_activated) - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "register_2 wait time = #{tUsedtime} ms" redirect_to my_account_url(:tip=>1) else redirect_to signin_path diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index fd10c06a4..827557a40 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -33,17 +33,10 @@ module AccountHelper end def automatically_register(user, &block) - tStarttime = Time.now # Automatic activation user.activate user.last_login_on = Time.now - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "register_130 wait time = #{tUsedtime} ms" if user.save - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "register_131 wait time = #{tUsedtime} ms" UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) #self.logged_user = user #flash[:notice] = l(:notice_account_activated) @@ -51,9 +44,6 @@ module AccountHelper else yield if block_given? end - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "register_132 wait time = #{tUsedtime} ms" user end diff --git a/app/models/user.rb b/app/models/user.rb index 5e37e84fd..c226e2a52 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -488,13 +488,9 @@ class User < Principal def update_hashed_password # update hashed_password if password was set - tStarttime = Time.now if self.password && self.auth_source_id.blank? salt_password(password) end - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "update_hashed_password wait time = #{tUsedtime} ms" end alias :base_reload :reload @@ -1190,38 +1186,32 @@ class User < Principal end end private - + def act_as_activity self.acts << Activity.new(:user_id => self.id) end #用户动态公共表记录 def act_as_principal_activity - tStarttime = Time.now self.principal_acts << PrincipalActivity.new(:user_id => self.id,:principal_id => self.id) - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "act_as_principal_activity wait time = #{tUsedtime} ms" end # 注册用户的时候消息默认点击时间为用户创建时间 def add_onclick_time - tStarttime = Time.now if OnclickTime.where("user_id =?" , self.id).first.nil? OnclickTime.create(:user_id => self.id, :onclick_time => self.created_on) end - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "add_onclick_time wait time = #{tUsedtime} ms" end #为新注册用户发送留言 def add_new_jour - tStarttime = Time.now + self.delay.add_new_jour_delay + end + + #为新注册用户发送留言 + def add_new_jour_delay + Rails.logger.info "add_new_jour_delay!!!!!!!!!" if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0" - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "add_new_jour_1 wait time = #{tUsedtime} ms" if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any? lead_message1 = Message.find(19292) notes1 = lead_message1.content @@ -1230,20 +1220,11 @@ class User < Principal lead_message3 = Message.find(19504) notes3 = lead_message3.content #user_id 默认为课程使者创建 - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "add_new_jour_2 wait time = #{tUsedtime} ms" self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0) self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0) self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "add_new_jour_3 wait time = #{tUsedtime} ms" end end - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "add_new_jour_4 wait time = #{tUsedtime} ms" end # 更新邮箱的同事,更新invite_lists表中的邮箱信息 @@ -1307,22 +1288,14 @@ class User < Principal def create_user_ealasticsearch_index - tStarttime = Time.now if self.id != 2 && self.id != 4 self.__elasticsearch__.index_document if Rails.env.production? end - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "create_user_ealasticsearch_index wait time = #{tUsedtime} ms" end def update_user_ealasticsearch_index - tStarttime = Time.now if self.id != 2 && self.id != 4 self.__elasticsearch__.update_document if Rails.env.production? end - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - Rails.logger.info "update_elastic wait time = #{tUsedtime} ms" end def delete_user_ealasticsearch_index if self.id != 2 && self.id != 4 diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 95e56d325..540e1bbff 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -11,8 +11,6 @@ class UsersService #成功返回注册后的User实例,失败直接抛异常 def register(params) - Rails.logger.info "register_11" - Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000 @user = User.new @user.admin = false @user.register @@ -21,8 +19,6 @@ class UsersService password = params[:password] password_confirmation = params[:password_confirmation] should_confirmation_password = params[:should_confirmation_password] - Rails.logger.info "register_12" - Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000 if !password.blank? && !password_confirmation.blank? && should_confirmation_password @user.password, @user.password_confirmation = password, password_confirmation elsif !password.blank? && !should_confirmation_password @@ -30,8 +26,6 @@ class UsersService else @user.password = "" end - Rails.logger.info "register_13" - Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000 case Setting.self_registration when '1' @user = email_activation_register(@user) @@ -40,15 +34,11 @@ class UsersService else @user = administrator_manually__register(@user) end - Rails.logger.info "register_14" - Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000 if @user.id != nil ue = @user.user_extensions ||= UserExtensions.new ue.user_id = @user.id ue.save end - Rails.logger.info "register_15" - Rails.logger.info Time.now.to_i*1000+Time.now.usec/1000 @user #img_url = url_to_avatar(@user) #gender = @user.user_extensions.gender.nil? ? 0 : @user.user_extensions.gender From 20f112d5ad517f6f12a91222f309602489d53ee6 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Nov 2016 09:23:23 +0800 Subject: [PATCH 18/42] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E8=AF=84=E5=88=86?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 14 +-- app/models/student_work.rb | 6 +- .../_set_score_rule_non_pro.html.erb | 101 ++++++++++++++++ .../_set_score_rule_none_pro_anon.html.erb | 69 +++++++++++ .../_set_score_rule_pro.html.erb | 111 ++++++++++++++++++ .../_set_score_rule_pro_anon.html.erb | 91 ++++++++++++++ .../homework_common/score_rule_set.js.erb | 33 +++++- .../set_evaluation_attr.js.erb | 1 - .../_evaluation_un_group_member_work.html.erb | 5 +- .../_evaluation_un_group_work.html.erb | 4 +- .../student_work/_evaluation_un_work.html.erb | 4 +- app/views/student_work/index.html.erb | 34 +++++- app/views/student_work/set_score_rule.js.erb | 3 +- app/views/users/_homework_base_info.html.erb | 2 +- public/javascripts/course.js | 15 ++- public/javascripts/new_user.js | 1 + public/stylesheets/css/common.css | 2 + 17 files changed, 463 insertions(+), 33 deletions(-) create mode 100644 app/views/homework_common/_set_score_rule_non_pro.html.erb create mode 100644 app/views/homework_common/_set_score_rule_none_pro_anon.html.erb create mode 100644 app/views/homework_common/_set_score_rule_pro.html.erb create mode 100644 app/views/homework_common/_set_score_rule_pro_anon.html.erb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index ea6a5ed6e..0e9599a51 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -975,7 +975,7 @@ class StudentWorkController < ApplicationController unless @homework.late_penalty.to_s == params[:late_penalty].to_s @homework.late_penalty = params[:late_penalty] - @homework.student_works.where("created_at > '#{@homework.end_time} 23:59:59'").each do |student_work| + @homework.student_works.where("commit_time > '#{@homework.end_time} 23:59:59'").each do |student_work| student_work.late_penalty = @homework.late_penalty student_work.save end @@ -986,7 +986,7 @@ class StudentWorkController < ApplicationController if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值 work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" @homework.student_works.each do |student_work| - absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count + absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0 student_work.save end @@ -995,7 +995,7 @@ class StudentWorkController < ApplicationController homework_detail_manual.save if homework_detail_manual end - teacher_priority = params[:teacher_priority] ? 1 : 0 + teacher_priority = params[:teacher_priority].to_i if homework_detail_manual.ta_proportion.to_s != params[:ta_proportion].to_s || @homework.teacher_priority.to_s != teacher_priority.to_s || (homework_detail_programing && homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s) homework_detail_manual.ta_proportion = params[:ta_proportion] homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing @@ -1011,7 +1011,7 @@ class StudentWorkController < ApplicationController end @homework.save - if params[:student_path] + if params[:student_path] && params[:student_path] == "true" redirect_to student_work_index_url(:homework => @homework.id) else @user_activity_id = params[:user_activity_id].to_i @@ -1481,11 +1481,11 @@ class StudentWorkController < ApplicationController #成绩计算 def set_final_score homework,student_work if homework && homework.homework_detail_manual - if homework.homework_type != 2 #匿评作业 + if homework.homework_type != 2 #非编程作业 if homework.teacher_priority == 1 #教师优先 if student_work.teacher_score student_work.final_score = student_work.teacher_score - student_work.work_score = student_work.teacher_score + student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty else if student_work.teaching_asistant_score.nil? student_work.final_score = student_work.student_score @@ -1528,7 +1528,7 @@ class StudentWorkController < ApplicationController if homework.teacher_priority == 1 #教师优先 if student_work.teacher_score student_work.final_score = student_work.teacher_score - student_work.work_score = student_work.teacher_score + student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty else if student_work.teaching_asistant_score.nil? #教辅未评分 if student_work.student_score.nil? diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 0a0c880c1..9b3124797 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -49,11 +49,11 @@ class StudentWork < ActiveRecord::Base #成绩计算 def set_final_score homework,student_work if homework && homework.homework_detail_manual - if homework.homework_type != 2 #匿评作业 + if homework.homework_type != 2 #非编程作业 if homework.teacher_priority == 1 #教师优先 if student_work.teacher_score student_work.final_score = student_work.teacher_score - student_work.work_score = student_work.teacher_score + student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty else if student_work.teaching_asistant_score.nil? student_work.final_score = student_work.student_score @@ -98,7 +98,7 @@ class StudentWork < ActiveRecord::Base if homework.teacher_priority == 1 #教师优先 if student_work.teacher_score student_work.final_score = student_work.teacher_score - student_work.work_score = student_work.teacher_score + student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty else if student_work.teaching_asistant_score.nil? #教辅未评分 if student_work.student_score.nil? diff --git a/app/views/homework_common/_set_score_rule_non_pro.html.erb b/app/views/homework_common/_set_score_rule_non_pro.html.erb new file mode 100644 index 000000000..c4ae3f58c --- /dev/null +++ b/app/views/homework_common/_set_score_rule_non_pro.html.erb @@ -0,0 +1,101 @@ +
      +
      +

      评分设置

      + +
      +
      + <%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post", :remote => !student_path) do |f|%> +
      +
      +
        +
      • + + +
      • +
      • + + value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/> +
      • +
      • + + +
      • +
      • + +
          +
        • + + +
        • +
        • + <%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %> + 助教评分 +
        • +
        • + + 学生匿评 +
        • +
        +
      • +
      +
        + + + + +
      +
      + 确定 + 取消 +
      +
      +<% end %> +
      + + \ No newline at end of file diff --git a/app/views/homework_common/_set_score_rule_none_pro_anon.html.erb b/app/views/homework_common/_set_score_rule_none_pro_anon.html.erb new file mode 100644 index 000000000..cb8ca942f --- /dev/null +++ b/app/views/homework_common/_set_score_rule_none_pro_anon.html.erb @@ -0,0 +1,69 @@ +
      +
      +

      评分设置

      + +
      +
      + <%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post", :remote => !student_path) do |f|%> +
      +
      +
        +
      • + + +
      • +
      • + + + +
      • +
      • + + + +
      • +
      +
        + + + +
      +
      + 确定 + 取消 +
      +
      + <% end %> +
      + + \ No newline at end of file diff --git a/app/views/homework_common/_set_score_rule_pro.html.erb b/app/views/homework_common/_set_score_rule_pro.html.erb new file mode 100644 index 000000000..1b1beb532 --- /dev/null +++ b/app/views/homework_common/_set_score_rule_pro.html.erb @@ -0,0 +1,111 @@ +
      +
      +

      评分设置

      + +
      +
      + <%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post", :remote => !student_path) do |f|%> +
      +
      +
        +
      • + + +
      • +
      • + + value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/> +
      • +
      • + + +
      • +
      • + +
          +
        • + + +
        • +
        • + <%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %> + 系统评分 +
        • +
        • + <%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing.ta_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %> + 助教评分 +
        • +
        • + + 学生匿评 +
        • +
        +
      • +
      +
        + + + + +
      +
      + 确定 + 取消 +
      + +
      + <% end%> +
      + \ No newline at end of file diff --git a/app/views/homework_common/_set_score_rule_pro_anon.html.erb b/app/views/homework_common/_set_score_rule_pro_anon.html.erb new file mode 100644 index 000000000..a69640782 --- /dev/null +++ b/app/views/homework_common/_set_score_rule_pro_anon.html.erb @@ -0,0 +1,91 @@ +
      +
      +

      评分设置

      + +
      +
      + <%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post", :remote => !student_path) do |f|%> +
      +
      +
        +
      • + + +
      • +
      • + + + +
      • +
      • + +
          +
        • + +
        • +
        • + <%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %> + 系统评分 +
        • +
        • + <%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing.ta_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %> + 助教评分 +
        • +
        +
      • +
      +
        + + + +
      +
      + 确定 + 取消 +
      + +
      + <% end %> +
      + + \ No newline at end of file diff --git a/app/views/homework_common/score_rule_set.js.erb b/app/views/homework_common/score_rule_set.js.erb index 2ea1fe4a5..abe8800e7 100644 --- a/app/views/homework_common/score_rule_set.js.erb +++ b/app/views/homework_common/score_rule_set.js.erb @@ -1,6 +1,27 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>'); -showModal('ajax-modal', '350px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); \ No newline at end of file +<% if @homework.homework_type == 2 %> + <% if @homework.anonymous_comment == 0 %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>"; + pop_box_new(htmlvalue, 570, 355); + <% else %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>"; + pop_box_new(htmlvalue, 500, 285); + <% end %> +<% else %> + <% if @homework.anonymous_comment == 0 %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_non_pro',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>"; + pop_box_new(htmlvalue, 500, 325); + <% else %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>"; + pop_box_new(htmlvalue, 500, 225); + <% end %> +<% end %> +function set_score_rule_submit() { + if($("#late_penalty_num").val() == ""){ + $("#late_penalty_num").val("0"); + } + if($("#absence_penalty_num").val() == ""){ + $("#absence_penalty_num").val("0"); + } + $('#muban_popup_box').find('form').submit(); + hideModal(); +} \ No newline at end of file diff --git a/app/views/homework_common/set_evaluation_attr.js.erb b/app/views/homework_common/set_evaluation_attr.js.erb index 672520ad7..c65034689 100644 --- a/app/views/homework_common/set_evaluation_attr.js.erb +++ b/app/views/homework_common/set_evaluation_attr.js.erb @@ -1,4 +1,3 @@ -hideModal(); <% if @hw_status == 5 %> $("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>"); <% else %> 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 240bac3d5..b078784c0 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 @@ -1,3 +1,4 @@ + <% is_expand = st.student_work_projects.empty? %>
      • @@ -56,11 +57,11 @@  <%= st.final_score%> 
        迟交扣分   - <%= st.homework_common && st.homework_common.teacher_priority == 1 && st.teacher_score ? 0 : st.late_penalty %> + <%= st.late_penalty %>  
        缺评扣分   - <%= st.homework_common && st.homework_common.teacher_priority == 1 && st.teacher_score ? 0 : st.absence_penalty%> + <%= st.absence_penalty%>  
        最终成绩为  <%= format("%.1f",score<0 ? 0 : score)%> 分 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 11a40bebd..583d5dd9e 100644 --- a/app/views/student_work/_evaluation_un_group_work.html.erb +++ b/app/views/student_work/_evaluation_un_group_work.html.erb @@ -72,11 +72,11 @@  <%= 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.late_penalty %>  分,
        缺评扣分   - <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty%> + <%= student_work.absence_penalty%>  分,
        最终成绩为  <%= format("%.1f",score<0 ? 0 : score)%> 分。 diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index e25196790..9b247f3d6 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -104,11 +104,11 @@  <%= 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.late_penalty %>  
        缺评扣分   - <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty%> + <%= student_work.absence_penalty%>  
        最终成绩为  <%= format("%.1f",score<0 ? 0 : score)%> 
        diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index b92152049..ab69f0c4b 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -48,14 +48,36 @@ // }); <%# end%> + function set_score_rule_submit() { + if($("#late_penalty_num").val() == ""){ + $("#late_penalty_num").val("0"); + } + if($("#absence_penalty_num").val() == ""){ + $("#absence_penalty_num").val("0"); + } + $('#muban_popup_box').find('form').submit(); + hideModal(); + } + //设置评分规则 function set_score_rule(){ - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework,:student_path => true}) %>'); - showModal('ajax-modal', '350px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before("" + - ""); - $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9"); + <% if @homework.homework_type == 2 %> + <% if @homework.anonymous_comment == 0 %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; + pop_box_new(htmlvalue, 570, 355); + <% else %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; + pop_box_new(htmlvalue, 500, 285); + <% end %> + <% else %> + <% if @homework.anonymous_comment == 0 %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_non_pro',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; + pop_box_new(htmlvalue, 500, 325); + <% else %> + var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; + pop_box_new(htmlvalue, 500, 225); + <% end %> + <% end %> } diff --git a/app/views/student_work/set_score_rule.js.erb b/app/views/student_work/set_score_rule.js.erb index 58aaa6f3e..964764df8 100644 --- a/app/views/student_work/set_score_rule.js.erb +++ b/app/views/student_work/set_score_rule.js.erb @@ -1,4 +1,3 @@ -clickCanel(); <% if @hw_status != 5 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); <% if @user_activity_id != @homework.id %> @@ -8,4 +7,4 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(r <% end %> <% else %> window.location.href = '<%=student_work_index_url(:homework => @homework.id) %>'; -<% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/_homework_base_info.html.erb b/app/views/users/_homework_base_info.html.erb index 631b879b7..bbc84011c 100644 --- a/app/views/users/_homework_base_info.html.erb +++ b/app/views/users/_homework_base_info.html.erb @@ -64,7 +64,7 @@ <% end %> <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> -

        分数:<%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分

        +

        分数:<%=format("%.1f",score<0 ? 0 : score) %>分

      <% if i == 4 %> <% break %> diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 13d93a3be..1945667af 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -626,7 +626,7 @@ $(function(){ //生成select function build_selector(max_num){ - var html = ""; for(var i = 0; i <= max_num; i += 10){ if( i == max_num){ html += ""; @@ -637,6 +637,18 @@ function build_selector(max_num){ html += ""; return html; } +function build_selector_sy(max_num){ + var html = ""; + return html; +} //提交匿评参数设置 function submit_set_evaluation_attr(end_time){ @@ -651,6 +663,7 @@ function submit_set_evaluation_attr(end_time){ } else{ $('#muban_popup_box form').submit(); + hideModal(); } } diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index 9282365d4..916481818 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -269,6 +269,7 @@ function submit_set_evaluation_attr(end_time){ } else{ $('#muban_popup_box form').submit(); + hideModal(); } } diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index c9ecc48fd..2770e6229 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -165,6 +165,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .mr60 {margin-right:60px;} .mr65 {margin-right:65px;} .mr70{margin-right: 70px;} +.mr75{margin-right: 75px;} .mr80{margin-right: 80px;} .mr95 {margin-right:95px !important;} .mr100 {margin-right:100px !important;} @@ -228,6 +229,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .w50 {width:50px;} .w56 {width:56px;} .w60{ width:60px;} +.w61{ width:61px;} .w70{ width:70px;} .w80{ width:80px;} .w90{ width:90px;} From c9db4d6bba97597b24a886ab513c49b0905f056b Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Nov 2016 09:54:30 +0800 Subject: [PATCH 19/42] =?UTF-8?q?=E5=AD=90=E6=A0=8F=E7=9B=AE=E8=AE=A8?= =?UTF-8?q?=E8=AE=BA=E5=8C=BA=E7=9A=84=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 9b63dcc88..78ca41ca2 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -21,7 +21,7 @@
      -
      +
      <%= @board.parent_id.nil? ? "班级讨论区" : "#{@board.name}" %>
      From 6f1c648770b94a10a4e0da339bee71b9d44e1f30 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Nov 2016 11:27:15 +0800 Subject: [PATCH 20/42] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E8=AF=84=E5=88=86=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E5=90=8C=E4=B8=80=E4=BA=BA=E7=9A=84=E4=B9=8B=E5=89=8D=E7=9A=84?= =?UTF-8?q?=E8=AF=84=E5=88=86=EF=BC=8C=E5=B0=B1=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 3 ++- app/helpers/student_work_helper.rb | 9 +++++++++ .../student_work/_programing_work_show.html.erb | 8 ++------ app/views/student_work/_show.html.erb | 11 ++--------- app/views/student_work/_student_work_list.html.erb | 6 +++--- .../_student_work_score_records.html.erb | 8 ++++++++ app/views/student_work/add_score.js.erb | 12 +++++++----- 7 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 app/views/student_work/_student_work_score_records.html.erb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 0e9599a51..979f74aa4 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -691,7 +691,7 @@ class StudentWorkController < ApplicationController def show @score = student_work_score @work,User.current @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - @student_work_scores = @work.student_works_scores.order("updated_at desc") + @student_work_scores = student_work_score_record(@work) respond_to do |format| format.js end @@ -854,6 +854,7 @@ class StudentWorkController < ApplicationController if @work.save @work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first @count = @homework.student_works.has_committed.count + @student_work_scores = student_work_score_record @work respond_to do |format| format.js end diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 63344fa1a..954e0ba48 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -69,6 +69,15 @@ module StudentWorkHelper str end + #获取学生作品的评分记录:同一个教师或教辅只显示最后一次评分 + def student_work_score_record work + sql = "SELECT MAX(id) id FROM student_works_scores WHERE (reviewer_role = 2 OR reviewer_role = 1) AND score IS NOT NULL AND student_work_id = #{work.id} GROUP BY user_id" + tea_ts_ids = StudentWorksScore.find_by_sql sql + tea_ts_ids = tea_ts_ids.empty? ? "(-1)" : "(" + tea_ts_ids.map{|tea| tea.id}.join(",") + ")" + scores = work.student_works_scores.where("score IS NULL or reviewer_role = 3 or id in #{tea_ts_ids}").order("updated_at desc") + return scores + end + #获取赞的总数 def praise_homework_count obj_id PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").count diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 6d5538e23..908b4a1d2 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -106,12 +106,8 @@
      -
      - <%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%> +
      + <%= render :partial => 'student_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => false} %>
      diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index cb9c7fbe0..786587d7b 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -109,15 +109,8 @@ <% end %> -
      - <%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%> - <% if is_member_work && student_work_scores.empty? && !@is_teacher %> -

      暂无评分

      - <% end %> +
      + <%= render :partial => 'student_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => is_member_work} %>
      diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index 8e34dc20f..94b033cd2 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -76,7 +76,7 @@ <% unless work.nil? %> location.hash = "<%=work.id %>"; <% if @homework.homework_type == 2 %> - $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>"); + $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>"); var program_name = "text/x-csrc"; var language = <%= @homework.language %>; @@ -100,9 +100,9 @@ value: $("#work-src_<%= work.id%>").text() }); <% elsif @homework.homework_type == 1 %> - $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>"); + $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>"); <% elsif @homework.homework_type == 3 %> - $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>"); + $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>"); <% end %> $('#score_<%= work.id%>').peSlider({range: 'min'}); <% end %> diff --git a/app/views/student_work/_student_work_score_records.html.erb b/app/views/student_work/_student_work_score_records.html.erb new file mode 100644 index 000000000..b0215d127 --- /dev/null +++ b/app/views/student_work/_student_work_score_records.html.erb @@ -0,0 +1,8 @@ +<%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%> +<% if is_member_work && student_work_scores.empty? && !@is_teacher %> +

      暂无评分

      +<% end %> \ No newline at end of file diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb index 6acf9eb45..5372360b9 100644 --- a/app/views/student_work/add_score.js.erb +++ b/app/views/student_work/add_score.js.erb @@ -1,12 +1,14 @@ $("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score}) %>"); $('#score_<%= @work.id%>').peSlider({range: 'min'}); -<% if @is_new%> - $("#score_list_<%= @work.id%>").prepend("
      <%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last_a}) %>
      "); -<% else %> - $("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last}) %>"); -<% end%> +<%# if @is_new%> + //$("#score_list_<%#= @work.id%>").prepend("
      <%#= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last_a}) %>
      "); +<%# else %> + //$("#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"); From fc19a468b790cfeb15ba3a348a9071bd479cf86c Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 4 Nov 2016 11:30:11 +0800 Subject: [PATCH 21/42] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=95=99=E8=A8=80?= =?UTF-8?q?=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journals_for_message.rb | 2 +- app/views/admin/leave_messages.html.erb | 21 +++++++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 2ea52fd92..2a432d42f 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -162,7 +162,7 @@ class JournalsForMessage < ActiveRecord::Base end def reset_counters! - self.class.reset_counters!(self) + # self.class.reset_counters!(self) end def self.reset_counters! journals_for_messages # jfm_id = journals_for_messages.id.to_i diff --git a/app/views/admin/leave_messages.html.erb b/app/views/admin/leave_messages.html.erb index a9acba903..f2d0a7dd9 100644 --- a/app/views/admin/leave_messages.html.erb +++ b/app/views/admin/leave_messages.html.erb @@ -68,20 +68,13 @@ <% end %> - <% if(journal.m_reply_count) %> - <%case journal.jour_type %> - <% when 'Principal' %> - <%= link_to(journal.m_reply_count, feedback_path(journal.jour_id)) %> - <% when 'Course' %> - <%= link_to(journal.m_reply_count, course_feedback_path(journal.jour_id)) %> - <% end %> - <% else %> - <%case journal.jour_type %> - <% when 'Principal' %> - <%= link_to(0, feedback_path(journal.jour_id)) %> - <% when 'Course' %> - <%= link_to(0, course_feedback_path(journal.jour_id)) %> - <% end %> + <% replys = JournalsForMessage.where(:m_parent_id=>journal.id) %> + <% reply_count = replys.nil? ? 0:replys.count %> + <%case journal.jour_type %> + <% when 'Principal' %> + <%= link_to(reply_count, feedback_path(journal.jour_id)) %> + <% when 'Course' %> + <%= link_to(reply_count, course_feedback_path(journal.jour_id)) %> <% end %> From 52ad68ffe15dd2572fd4239272937bde64f4e0c2 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Nov 2016 13:37:20 +0800 Subject: [PATCH 22/42] =?UTF-8?q?=E4=B8=8D=E9=99=90=E5=AE=9A=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E4=BA=BA=E6=95=B0=E6=97=B6=EF=BC=8C=E4=B9=9F=E5=8F=AF?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BC=BA=E8=AF=84=E6=89=A3=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/_set_score_rule_non_pro.html.erb | 2 +- app/views/homework_common/_set_score_rule_pro.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/homework_common/_set_score_rule_non_pro.html.erb b/app/views/homework_common/_set_score_rule_non_pro.html.erb index c4ae3f58c..afa768838 100644 --- a/app/views/homework_common/_set_score_rule_non_pro.html.erb +++ b/app/views/homework_common/_set_score_rule_non_pro.html.erb @@ -14,7 +14,7 @@
    • - value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/> +
    • diff --git a/app/views/homework_common/_set_score_rule_pro.html.erb b/app/views/homework_common/_set_score_rule_pro.html.erb index 1b1beb532..bf1432fdd 100644 --- a/app/views/homework_common/_set_score_rule_pro.html.erb +++ b/app/views/homework_common/_set_score_rule_pro.html.erb @@ -14,7 +14,7 @@
    • - value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/> +
    • From a9265f3b35c33d3a45e247e23eb8c7985595cc9b Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Nov 2016 13:55:29 +0800 Subject: [PATCH 23/42] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E5=88=9B=E5=BB=BA=E7=8F=AD=E7=BA=A7=E6=89=8D?= =?UTF-8?q?=E8=83=BD=E5=BC=80=E5=B1=95=E6=95=99=E5=AD=A6=E7=9A=84=E5=BC=95?= =?UTF-8?q?=E5=AF=BC=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/syllabuses/_syllabus_course_list.html.erb | 3 ++- app/views/syllabuses/show.html.erb | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/syllabuses/_syllabus_course_list.html.erb b/app/views/syllabuses/_syllabus_course_list.html.erb index 6adcae4a7..05555d341 100644 --- a/app/views/syllabuses/_syllabus_course_list.html.erb +++ b/app/views/syllabuses/_syllabus_course_list.html.erb @@ -79,7 +79,8 @@ <% if User.current.member_of_syl?(@syllabus) %>

      该课程还未创建班级,请 <%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "sy_corange", :target => '_blank'%> - ,谢谢啦!

      + ,谢谢啦!
      只有创建班级后才可以开展在线教学哦~ +

      <% else %>

      该课程还未创建班级,敬请期待!

      <% end %> diff --git a/app/views/syllabuses/show.html.erb b/app/views/syllabuses/show.html.erb index 7e5af4ec0..7587262eb 100644 --- a/app/views/syllabuses/show.html.erb +++ b/app/views/syllabuses/show.html.erb @@ -28,6 +28,9 @@
    • + <% if User.current == @syllabus.user && @syllabus.courses.empty? %> +

      您还没有创建班级,只有<%= link_to "创建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "linkBlue2", :target => '_blank'%>后才可以开展在线教学哦~

      + <% end %> <% if @syllabus.des_status == 0 && User.current == @syllabus.user %>

      您建立的课程尚未填写课程大纲,请完善您的 <%=link_to '课程大纲', edit_syllabus_path(@syllabus), :class => 'sy_corange' %>,谢谢啦!

      From d762c68f7b3d418de52d5fdbe0d432b435c5a6f7 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Nov 2016 16:10:13 +0800 Subject: [PATCH 24/42] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=9A=84=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E5=92=8C=E8=AF=84?= =?UTF-8?q?=E5=88=86=E5=A4=84=E7=90=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 10 +- app/helpers/student_work_helper.rb | 13 ++- app/views/student_work/_add_score.html.erb | 3 + .../_evaluation_un_group.html.erb | 2 - .../_evaluation_un_group_member_work.html.erb | 34 +++--- .../_evaluation_un_group_work.html.erb | 107 ++++++------------ .../student_work/_group_member_work.html.erb | 4 +- .../_programing_work_show.html.erb | 2 +- app/views/student_work/_show.html.erb | 4 +- .../student_work/_student_work_list.html.erb | 11 +- app/views/student_work/add_score.js.erb | 4 +- public/javascripts/application.js | 2 +- public/stylesheets/css/public.css | 4 +- 13 files changed, 88 insertions(+), 112 deletions(-) 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? %>
      • -
        > +
        <%= link_to(image_tag(url_to_avatar(st.user),:width =>"40",:height => "40", :style => "display:block;"),user_activities_path(st.user), :class => "fl") %> <% if !is_expand %> - - + + (组长) -
      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;} From 6db223b35b392e0f2f3a30ba097c919c8e0c575f Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Nov 2016 16:13:06 +0800 Subject: [PATCH 25/42] =?UTF-8?q?=E9=9D=9E=E8=80=81=E5=B8=88=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=88=86=E7=BB=84=E4=BD=9C=E5=93=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E2=80=9C=E8=AF=84=E5=88=86=E2=80=9D=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student_work/_evaluation_un_group_member_work.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 e50a3626e..9a03fbdc6 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 @@ -71,7 +71,9 @@
      -
      评分
      + <% if User.current.allowed_to?(:as_teacher, st.homework_common.course) %> +
      评分
      + <% end %>
    • From 23edad0687f90a0183f8ed116d08f14f4d2eca37 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Nov 2016 16:37:50 +0800 Subject: [PATCH 26/42] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_homework_base_info.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/_homework_base_info.html.erb b/app/views/users/_homework_base_info.html.erb index bbc84011c..a3d216ef2 100644 --- a/app/views/users/_homework_base_info.html.erb +++ b/app/views/users/_homework_base_info.html.erb @@ -29,7 +29,7 @@
      <% end %>
      -<% if activity.student_works.count != 0 %> +<% if activity.student_works.has_committed.count != 0 %> <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> <%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %> <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %> @@ -64,7 +64,7 @@ <% end %> <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> -

      分数:<%=format("%.1f",score<0 ? 0 : score) %>分

      +

      分数:<%=format("%.1f",score.to_f < 0 ? 0 : score.to_f) %>分

      <% if i == 4 %> <% break %> From 0bbccab6163c212c76be4913c55d284b8fb0e788 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Nov 2016 16:59:33 +0800 Subject: [PATCH 27/42] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student_work/_evaluation_un_group_member_work.html.erb | 2 +- public/stylesheets/css/moduel.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 9a03fbdc6..d9c34ab91 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 @@ -17,7 +17,7 @@ <% end %>
      diff --git a/public/stylesheets/css/moduel.css b/public/stylesheets/css/moduel.css index 871b72c9e..fc2e70380 100644 --- a/public/stylesheets/css/moduel.css +++ b/public/stylesheets/css/moduel.css @@ -8,7 +8,7 @@ a:hover.muban_icons_close{background: url(../images/sy/sy_icons_close.png) -40px #muban_popup_box label.pop_box_label{width: 100px; text-align: right; display: inline-block;} input.radio-width90{ width: 90px; } #muban_popup_box input,#muban_popup_box select{ border:1px solid #c8c8c8; height: 28px; color: #888;} -#muban_popup_box label{width: 100px; text-align: right; display: inline-block;} +#muban_popup_box label.pop_box_label {width: 100px; text-align: right; display: inline-block;} /*模板表格 20161013byLB*/ .muban_table{ width:100%; background:#fff; border:1px solid #e5e5e5; border-bottom: none; } .muban_table thead tr{ height:40px; line-height:40px;} From 94284e72a215e1f00dff23232aac9de331d6dfca Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Nov 2016 18:43:44 +0800 Subject: [PATCH 28/42] =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=81=20=E8=AF=BE=E7=A8=8B=E5=A4=A7?= =?UTF-8?q?=E7=BA=B2=E7=9A=84=E6=8F=90=E7=A4=BA=EF=BC=8C=E5=9C=A8=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=96=87=E5=AD=97=E7=9A=84=E5=89=8D=E5=90=8E=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E5=90=84=E7=A9=BA=E4=B8=80=E6=A0=BC=E3=80=81=20?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E7=9A=84=E5=90=84=E7=A7=8D?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=9C=AA=E7=9F=A5=E9=9C=80=E8=A6=81=E5=AF=B9?= =?UTF-8?q?=E9=BD=90=E3=80=81=20=E8=AF=84=E5=88=86=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=AD=89=E6=96=B0=E5=BC=B9=E6=A1=86=EF=BC=9A=E5=A6=82=E5=9B=BE?= =?UTF-8?q?=E5=BD=93=E9=BC=A0=E6=A0=87=E7=A7=BB=E8=87=B3=E5=8F=B3=E4=B8=8A?= =?UTF-8?q?=E8=A7=92=E5=85=B3=E9=97=AD=E5=9B=BE=E6=A0=87=EF=BC=8C=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E4=B8=A2=E5=A4=B1=E3=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_applied_join_project.html.erb | 2 + .../_show_attachment_history.html.erb | 3 +- .../_show_attachment_history_delete.html.erb | 3 +- .../courses/_join_private_course.html.erb | 2 +- app/views/poll/_cancel_poll.html.erb | 2 + app/views/poll/_poll_save.html.erb | 3 +- app/views/poll/_poll_submit.html.erb | 3 +- .../_evaluation_un_group_member_work.html.erb | 2 +- .../_evaluation_un_group_work.html.erb | 48 ++++++++++--------- app/views/syllabuses/show.html.erb | 2 +- .../_homework_repository_detail.html.erb | 2 +- .../users/_send_homework_to_course.html.erb | 2 +- public/stylesheets/css/courses.css | 2 +- public/stylesheets/css/moduel.css | 2 +- 14 files changed, 44 insertions(+), 34 deletions(-) diff --git a/app/views/applied_project/_applied_join_project.html.erb b/app/views/applied_project/_applied_join_project.html.erb index 2e2f657d6..26d1ee915 100644 --- a/app/views/applied_project/_applied_join_project.html.erb +++ b/app/views/applied_project/_applied_join_project.html.erb @@ -1,3 +1,4 @@ +

      欢迎加入项目

      @@ -35,3 +36,4 @@ <% end %>
      +
      \ No newline at end of file diff --git a/app/views/attachments/_show_attachment_history.html.erb b/app/views/attachments/_show_attachment_history.html.erb index 9a1a278fc..69d28b681 100644 --- a/app/views/attachments/_show_attachment_history.html.erb +++ b/app/views/attachments/_show_attachment_history.html.erb @@ -1,11 +1,12 @@ +

      更新资源版本

      -
      <%= render :partial => "files/attachment_history_popub" %>
      +
      diff --git a/app/views/attachments/_show_attachment_history_delete.html.erb b/app/views/attachments/_show_attachment_history_delete.html.erb index 6a73f057a..85f46ea72 100644 --- a/app/views/attachments/_show_attachment_history_delete.html.erb +++ b/app/views/attachments/_show_attachment_history_delete.html.erb @@ -1,3 +1,4 @@ +

      删除资源

      @@ -9,7 +10,7 @@ <%= render :partial => "files/attachment_history_popub_delete" %>
      - +