From ab8a8bfebc897fb2bba2fedbf1dcde7e48ebff38 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 30 Sep 2017 16:49:24 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=B6=EF=BC=8C=E7=82=B9=E5=87=BB=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E6=8C=89=E9=92=AE=E5=90=8E=E5=BC=B9=E6=A1=86=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=B6=88=E5=A4=B1=E5=AF=BC=E8=87=B4=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=97=A0=E6=95=B0=E6=AC=A1=EF=BC=8C=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=A4=9A=E6=9D=A1=E4=B8=80=E6=A0=B7=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/edu/homework.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/javascripts/edu/homework.js b/public/javascripts/edu/homework.js index 227c28b99..7d28bd571 100644 --- a/public/javascripts/edu/homework.js +++ b/public/javascripts/edu/homework.js @@ -346,5 +346,6 @@ function new_shixun_homework(id){ var type=$("input[name='shixun_homework']:checked").val(); console.log(type); $("#shixun_homework_common_new").submit(); + hideModal(); } } From af3ca949dc9a2df3e16c07fee3c6800c7c9f2524 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 30 Sep 2017 16:53:06 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E5=8F=AA=E8=83=BD=E6=98=AF=E7=8F=AD=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E6=89=8D=E5=8F=AF=E4=BB=A5=EF=BC=8C=E6=95=99=E5=B8=88?= =?UTF-8?q?=E6=88=90=E5=91=98=E4=B8=AD=E5=85=B6=E4=BB=96=E6=95=99=E5=B8=88?= =?UTF-8?q?=E6=88=96=E5=8A=A9=E6=95=99=E4=B8=8D=E5=BA=94=E8=AF=A5=E6=9C=89?= =?UTF-8?q?=E6=AD=A4=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_course_base_info.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index 893fb84cf..18fce614e 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -101,7 +101,9 @@
  • 恢复邀请码
  • <% end %>
  • <%= link_to "设置", {:controller => 'courses', :action => 'settings', :id => @course} %>
  • -
  • 删除
  • + <% if User.current == @course.teacher || User.current.admin? %> +
  • 删除
  • + <% end %> From b17305f84875e9417fb7a72ca54d82bfe10cd23a Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 30 Sep 2017 17:38:17 +0800 Subject: [PATCH 3/6] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 4 ++-- app/helpers/courses_helper.rb | 9 +++++++++ app/views/courses/_course_activity_content.html.erb | 2 +- app/views/courses/settings/_student_table.html.erb | 2 +- app/views/exercise/_exercise_student.html.erb | 2 ++ app/views/layouts/base_courses.html.erb | 2 +- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 6fe639260..6d68ff08c 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -31,7 +31,7 @@ class ExerciseController < ApplicationController exercises = exercises.where("exercise_name like '%#{@search}%'") end @exercises = paginateHelper exercises,15 #分页 - @left_nav_type = 8 + @left_nav_type = 4 respond_to do |format| format.js format.html @@ -172,7 +172,7 @@ class ExerciseController < ApplicationController @exercise = Exercise.find(params[:id]) exercise_questions = @exercise.exercise_questions @exercise_questions = paginateHelper exercise_questions, 5 - @left_nav_type = 8 + @left_nav_type = 4 respond_to do |format| format.html{render :layout => 'base_courses'} end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 21acbdcb2..1a19f3180 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -12,6 +12,15 @@ module CoursesHelper #AllPeople = StudentRoles+TeacherRoles ## return people count + def student_course_homework_score course, user + homework_ids = course.homework_commons.where("homework_type in (1, 4) and publish_time < '#{Time.now}'").map(&:id) + score = 0 + user.student_works.where(:homework_common_id => homework_ids).each do |work| + score = score + work.work_score if work.work_score + end + format("%.1f",score) + end + # 学生的发布资源数 def student_course_resource_num course, user num = course.attachments.where(:author_id => user.id).count diff --git a/app/views/courses/_course_activity_content.html.erb b/app/views/courses/_course_activity_content.html.erb index 5b7d02b73..87d5c9252 100644 --- a/app/views/courses/_course_activity_content.html.erb +++ b/app/views/courses/_course_activity_content.html.erb @@ -32,7 +32,7 @@ <%= link_to '实训作业'.html_safe, shixuns_homework_common_index_path(:course => @course.id),:class => "color-grey", :remote => true %>
  • - 试      卷 + <%= link_to '试      卷'.html_safe, new_exercise_path(:course_id => @course.id),:class => "color-grey" %>
  • 资      源 diff --git a/app/views/courses/settings/_student_table.html.erb b/app/views/courses/settings/_student_table.html.erb index a822f7de7..3248e4616 100644 --- a/app/views/courses/settings/_student_table.html.erb +++ b/app/views/courses/settings/_student_table.html.erb @@ -41,7 +41,7 @@ <%= link_to user.show_real_name, user_path(user), :class => 'edu-txt-w140 task-hide mt5 alink-name', :target => '_blank' %> <%= user.user_extensions ? user.user_extensions.student_id : '' %> <%= member.course_group_id == 0 ? '未分班' : member.course_group.name %> - <%#= student_course_resource_num @course, user %> + <%= student_course_homework_score @course, user %> <%= student_course_resource_num @course, user %> <%= student_course_message_num @course, user %> <%= student_course_reply_num @course, user %> diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index d06dc69dc..1509fda18 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -76,6 +76,8 @@ <% if @exercise.question_random == 1 %> <% question_list = @exercise.exercise_questions.shuffle %> + <% else %> + <% question_list = @exercise.exercise_questions %> <% end %>
    diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 6d3e385f0..9ed00f231 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -117,7 +117,7 @@ <%#= link_to( "+", new_board_message_path(:board_id => course_board.id), :class => 'fr mr15 font-18 link-color-grey', :title => "#{l(:label_message_new)}") if User.current.logged? %>
  • <% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %> -
  • +
  • 试卷 <%= count %> <%#= link_to( "+", new_exercise_path(:course_id => @course.id), :class => 'fr mr15 font-18 link-color-grey', :title =>"新建试卷") if is_teacher %> From 216a102f0a9ef441c3a97147e3907f8e3cf5a4a9 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 30 Sep 2017 18:34:21 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=AF=84=E9=98=85=E6=97=B6=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E8=AF=84=E9=98=85=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_exercise_student_result.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index cbfa08564..6537a3152 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -179,6 +179,7 @@ var spn_class = dataObj.score == 0 ? 'color-red' : 'color-light-green' $("#multi_q_score_"+id).html(""+dataObj.score+ "分"); $("#exercise_user_score").html(dataObj.total_score); + $("#ex_comment_status_"+id).removeClass("post_btn_grey").addClass("post_btn_white"); $("#ajax_notice_p").html("分数已保存"); $("#ajax-notice").css('top', $(window).scrollTop()+400); $("#ajax-notice").show(); From 78aded045175203586219cc1bf3e354080988497 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 30 Sep 2017 18:38:19 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E7=A9=BA=E7=99=BD=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_exercise_student.html.erb | 2 +- app/views/exercise/_exercise_student_result.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index 1509fda18..8b9ff2b83 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -59,7 +59,7 @@ <%= format_time @exercise_user.start_at %> 开始答题 - <% unless @exercise.try(:exercise_description).nil? %> + <% if !@exercise.try(:exercise_description).nil? && @exercise.try(:exercise_description) != "" %>
    <%= @exercise.try(:exercise_description).html_safe%>
    diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index 6537a3152..79ade0035 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -26,7 +26,7 @@ <%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %> -<% unless @exercise.try(:exercise_description).nil? %> + <% if !@exercise.try(:exercise_description).nil? && @exercise.try(:exercise_description) != "" %>
    <%= @exercise.try(:exercise_description).html_safe%>
    From 1f51fa5a825ab1875cf19f3966fb038df7ec30ba Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 18:39:51 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9A=84=E4=B8=80=E4=BA=9B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 5 ++++- app/views/games/_game_show.html.erb | 13 +++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index dee8d5bf5..d8422beaa 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -67,7 +67,10 @@ class GamesController < ApplicationController shixun_new_commit = g.commits(@myshixun.shixun.try(:gpid)).first.try(:id) @myshixun.update_column(:commit_id, shixun_new_commit) sleep(2) # g - render :json => {:status => 200} + respond_to do |format| + format.js{ redirect_to myshixun_game_path( @game, :myshixun_id => @myshixun)} + end + # render :json => {:status => 200} end def index diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 9436b6fc2..5eb64b918 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -210,17 +210,18 @@ function sync_hide_tip_content(){ $(".tip-panel-animate").addClass("animate-tip-hide"); setTimeout('$(".tip-panel-animate").hide();', 700); - alert("test"); $.ajax({ url: "<%= sync_codes_myshixun_game_path(@game, :myshixun_id => @myshixun) %>", dataType: "script", success: function(data){ - alert(data.status); - if(data.status == 200){ - $('#ajax-indicator-base').html("").hide(); - $('#'+target).html(data); - } +// $('#ajax-indicator-base').html("").hide(); } }) } + + //隐藏更新提示方法 + function hide_tip_content(){ + $(".tip-panel-animate").addClass("animate-tip-hide"); + setTimeout('$(".tip-panel-animate").hide();', 700); + } \ No newline at end of file