diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index f31ff8eb5..f2ae14598 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -536,6 +536,21 @@ class AccountController < ApplicationController redirect_to professional_certification_account_path end + # 修改资料时判断学号是否已使用 + def check_user_student_id + data = {result:0, account:""} + if params[:student_id] && params[:school_id] + if UserExtensions.where("student_id = '#{params[:student_id]}' and school_id = #{params[:school_id]} and user_id != #{User.current.id}").count > 0 + user = User.where(:id => UserExtensions.where("student_id = '#{params[:student_id]}' and school_id = #{params[:school_id]} and user_id != #{User.current.id}").map(&:user_id)).first + data[:account] = user.mail.blank? ? user.user_phone : user.user_mail + else + data[:result] = 1 + end + end + render :json => data + end + + # 实名认证时判断学号是否已使用 def check_student_id data = {result:0, account:""} if params[:student_id] && params[:school_id] @@ -555,6 +570,7 @@ class AccountController < ApplicationController render :json => data end + # 实名认证时判断证件号码是否已使用 def check_id_number data = {result:0, account:""} if params[:id_number] diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index c4eaeee70..bdf25d52b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -106,7 +106,7 @@ class CoursesController < ApplicationController end def shixun_statistics - @homeworks = @course.homework_commons.where("homework_type = 4").order("created_at asc") + @homeworks = @course.homework_commons.where("homework_type = 4 and publish_time < '#{Time.now}'").order("publish_time desc") filename="#{format_date(Time.now)}_#{@course.teacher.show_real_name.to_s}_#{@course.name}_实训数据报告"; respond_to do |format| @@ -2007,6 +2007,83 @@ class CoursesController < ApplicationController blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 black = Spreadsheet::Format.new :color => :black, :weight => :bold, :size => 10 current_row = 0 + sheet = book.create_worksheet :name => "学员统计" + sheet.row(0).default_format = blue + sheet.row(0).concat(["学生id","学生姓名","作业编号","作业/实训名称","关卡"," 经验值","金币","评测历史","评测时间","评测结果"]) + course.student.each_with_index do |course, i| + # 总统计 + count_exp_score = 0 + count_gold_score = 0 + count_test = 0 + count_time = 0 + game_count = 0 + # end + user = course.student + current_row += 1 + sheet[current_row, 0] = user.login + sheet[current_row, 1] = user.show_real_name + homeworks.each_with_index do |homework, j| + # 关卡统计 + count_game_exp_score = 0 + count_game_gold_score = 0 + count_game_test = 0 + count_game_time = 0 + # end + sheet[current_row, 2] = "# #{j + 1}" + sheet[current_row, 3] = homework.name + shixun = homework.homework_commons_shixuns.shixun if homework.homework_commons_shixuns + if shixun + shixun.challenges.each_with_index do |challenge, k| + sheet[current_row, 4] = "第#{k+1}关" + games = Game.where(:challenge_id => challenge.id, :user_id => user.id) + game_count = game_count + games.count + if games.count > 0 + games.each do |game| + sheet[current_row, 5] = game.final_score ? "+#{game.final_score.to_s}" : "--" + sheet[current_row, 6] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i}" : "+#{game.final_score.to_i}") : "--" + count_exp_score += (game.final_score ? game.final_score.to_i : 0) + count_gold_score += (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0) + count_game_exp_score += (game.final_score ? game.final_score.to_i : 0) + count_game_gold_score += (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0) + count = game.outputs.count + if count > 0 + outputs = game.outputs.where(:test_set_position => 1).reorder("created_at asc") + outputs.each_with_index do |output, k| + count_test += 1 + count_game_test += 1 + sheet[current_row, 7] = "第#{k+1}次评测" + sheet[current_row, 8] = k == 0 ? game_spend_time((output.created_at - game.created_at).to_i) : game_spend_time((output.created_at - outputs[k-1].created_at).to_i) + count_time = count_time + (k == 0 ? (output.created_at - game.created_at).to_i : (output.created_at - outputs[k-1].created_at).to_i) + count_game_time += (k == 0 ? (output.created_at - game.created_at).to_i : (output.created_at - outputs[k-1].created_at).to_i) + sheet[current_row, 9] = game.outputs.where(:query_index => output.query_index).select{|ou| ou.result == false}.count > 0 ? "失败" : "成功" + current_row += 1 + end + else + current_row += 1 + end + end + else + current_row += 1 + end + end + end + sheet[current_row,4] = "合计" + sheet[current_row,5] = count_game_exp_score >= 0 ? "+#{count_game_exp_score}" : "-#{count_game_exp_score}" + sheet[current_row,6] = count_game_gold_score >= 0 ? "+#{count_game_gold_score}" : "#{count_game_gold_score}" + sheet[current_row,7] = "共#{count_game_test}次评测" + sheet[current_row,8] = game_spend_time((count_game_time == 0 ? 0 : (count_game_time / count_test)).to_i)+"/次" + sheet.row(current_row).default_format = black + current_row += 1 + end + sheet[current_row,2] = "合计" + sheet[current_row,4] = "共#{game_count}" + sheet[current_row,5] = count_exp_score >= 0 ? "+#{count_exp_score}" : "-#{count_exp_score}" + sheet[current_row,6] = count_gold_score >= 0 ? "+#{count_gold_score}" : "#{count_gold_score}" + sheet[current_row,7] = "共#{count_test}次评测" + sheet[current_row,8] = game_spend_time((count_time == 0 ? 0 : (count_time / count_test)).to_i)+"/次" + sheet.row(current_row).default_format = black + end + homeworks.each_with_index do |homework, i| sheet = book.create_worksheet :name => "第#{i+1}次作业" sheet.row(0).default_format = blue @@ -2043,14 +2120,14 @@ class CoursesController < ApplicationController user = game.user sheet[current_row,6] = user.login sheet[current_row,7] = user.show_real_name - sheet[current_row,8] = game.final_score ? "+#{game.final_score.to_s} 经验值" : "--" + sheet[current_row,8] = game.final_score ? "+#{game.final_score.to_s}" : "--" count_exp_score = count_exp_score + (game.final_score ? game.final_score.to_i : 0) - sheet[current_row,9] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i} 金币" : "+#{game.final_score.to_i} 金币") : "--" + sheet[current_row,9] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i}" : "+#{game.final_score.to_i}") : "--" count_gold_score = count_gold_score + (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0) count = game.outputs.count if count > 0 - outputs = game.outputs.where(:test_set_position => 1).order("created_at asc") + outputs = game.outputs.where(:test_set_position => 1).reorder("created_at asc") outputs.each_with_index do |output, k| count_test = count_test + 1 sheet[current_row,10] = "第#{k+1}次评测" @@ -2069,8 +2146,8 @@ class CoursesController < ApplicationController sheet[current_row,6] = "合计" sheet[current_row,7] = games.count.to_s + "人" - sheet[current_row,8] = count_exp_score >= 0 ? "+#{count_exp_score} 经验值" : "-#{count_exp_score} 经验值" - sheet[current_row,9] = count_gold_score >= 0 ? "+#{count_gold_score} 金币" : "-#{count_gold_score} 金币" + sheet[current_row,8] = count_exp_score >= 0 ? "+#{count_exp_score}" : "-#{count_exp_score}" + sheet[current_row,9] = count_gold_score >= 0 ? "+#{count_gold_score}" : "#{count_gold_score}" sheet[current_row,10] = "共#{count_test}次评测" sheet[current_row,11] = game_spend_time((count_time == 0 ? 0 : (count_time / count_test)).to_i)+"/次" sheet.row(current_row).default_format = black diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index ee40a76bd..d5522b898 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -89,7 +89,7 @@ class GamesController < ApplicationController # @praise 判断是否点赞 # @tread 判断是否踩 # git_repository_url @myshixun, "Myshixun" - # @st 0 实践任务 1 多选任务 2 单选任务 + # @st 0 实践任务 1 选择题任务 def show # 展示全部实训 @is_subject = params[:is_subject] diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 6e56e44c6..26f89d0e3 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -31,22 +31,22 @@ class HomeworkCommonController < ApplicationController end if @order.blank? if @is_teacher - @homework_commons = @homework_commons.order("created_at desc") + @homework_commons = @homework_commons.order("publish_time desc") else - @homework_commons = @homework_commons.where("publish_time <= '#{Time.now}'").order("created_at desc") + @homework_commons = @homework_commons.where("publish_time <= '#{Time.now}'").order("publish_time desc") end else case @order when '1' - @homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and end_time > '#{Time.now}'").order("homework_commons.created_at desc") + @homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and end_time > '#{Time.now}'").order("homework_commons.publish_time desc") when '3' - @homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.evaluation_end > '#{Time.now}'").order("homework_commons.created_at desc") + @homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.evaluation_end > '#{Time.now}'").order("homework_commons.publish_time desc") when '4' - @homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.appeal_time > '#{Time.now}')").order("homework_commons.created_at desc") + @homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.appeal_time > '#{Time.now}')").order("homework_commons.publish_time desc") when '5' - @homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and archive_time > '#{Time.now}')").order("homework_commons.created_at desc") + @homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and archive_time > '#{Time.now}')").order("homework_commons.publish_time desc") else - @homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order}").order("homework_commons.created_at desc") + @homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order}").order("homework_commons.publish_time desc") end end @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 7e54df3f1..6b962e35d 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -823,7 +823,7 @@ end @courselist= @courselist.where("name like '%#{search}%'") end end - @courselist = @courselist.order("created_at #{@sx_order}") + @courselist = @courselist.order("id #{@sx_order}") @courselist_count = @courselist.count limit = 20 @is_remote = true @@ -1591,7 +1591,7 @@ end else #同意 shixun.update_column('status', 2) apply_action.update_attributes(:status => 1, :dealer_id => User.current.id) - shixun_modify_status_without_publish shixun, 1 + add_shixun_modify_status shixun, 1 # 实训发布后则不允许修改代码 # g = Gitlab.client # shixun.shixun_members.each do |member| diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index acd042a11..79639da1f 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -283,6 +283,9 @@ class MessagesController < ApplicationController #@replies = @replies[@page * @limit..@page * @limit + 9] @reply = Message.new() @user_activity_id = params[:user_activity_id].blank? ? @topic.id : params[:user_activity_id].to_i + if !params[:user_activity_id].blank? && params[:user_activity_id].to_i != @topic.id + @topic.update_attributes(:visits => @topic.visits + 1) + end respond_to do |format| format.js end diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index b2ae7e65c..882f255aa 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -235,7 +235,19 @@ class MyController < ApplicationController if @user.save && @se.save reward_grade(@user, @user.id, 'Account', 500) - # 修改邮箱的时候同步修改到gitlab + + if @se.identity == 1 + school_ids = School.where(:auto_users_trial => 1).map(&:id) + if !@se.student_id.nil? && @se.student_id != "" && !@se.school.nil? && school_ids.include?(@se.school_id) + apply_action = ApplyAction.where(:user_id => @user.id, :container_type => "TrialAuthorization", :status => 0).first + + unless apply_action.blank? + @user.update_attributes(:certification => 1) + apply_action.update_attributes(:status => 1) + end + end + end + # 修改邮箱的时候同步修改到gitlab # if changed_mail || changed_login # g = Gitlab.client # s = Trustie::Gitlab::Sync.new diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 2fb901d77..a5f3a9782 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -367,16 +367,26 @@ class ShixunsController < ApplicationController # jenkins回调脚本 # gameID 及实训ID def publish + @status = 0 + @position = "" begin - @shixun.update_attributes!(:status => 1) - apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first - if apply && apply.status == 0 - @status = 0 - else - ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => User.current.id, :status => 0) - notes = User.current.show_name.to_s + " 申请发布实训:#{@shixun.name}" - JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0) - @status = 1 + @shixun.challenges.each do |challenge| + if challenge.challenge_tags.count == 0 + @status = 2 + @position = (@position == "" ? @position : (@position + ",")) + challenge.position.to_s + "关" + end + end + if @status == 0 + @shixun.update_attributes!(:status => 1) + apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first + if apply && apply.status == 0 + @status = 0 + else + ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => User.current.id, :status => 0) + notes = User.current.show_name.to_s + " 申请发布实训:#{@shixun.name}" + JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0) + @status = 1 + end end rescue Exception => e @jenkin_error = true @@ -610,23 +620,28 @@ class ShixunsController < ApplicationController gshixun = g.edit_project(gshixun.id, new_shixun.identifier, new_shixun.identifier) raise "实训复制失败" if (gshixun.try(:name) != new_shixun.identifier || gshixun.try(:path) != new_shixun.identifier) new_shixun.update_column(:gpid, gshixun.id) + # 同步复制者至gitlab,必须要求用户绑定了邮箱 + ShixunMember.create!(:user_id => User.current.id, :shixun_id => new_shixun.try(:id), :role => 1) + s = Trustie::Gitlab::Sync.new + gid = User.current.try(:gid) + u = g.add_team_member(gshixun.id, gid, 40) # 3代表角色master - # 同步复制合作者,合作者加入到gitlab - unless User.current.manager_of_shixun?(@shixun) - ShixunMember.create!(:user_id => User.current.id, :shixun_id => new_shixun.try(:id), :role => 1) - end - @shixun.shixun_members.each do |shixun_member| - if ShixunMember.where(:shixun_id => new_shixun.try(:id), :user_id => shixun_member.user_id).blank? - ShixunMember.create!(:user_id => shixun_member.try(:user_id), :shixun_id => new_shixun.try(:id), - :role => (shixun_member.try(:user_id) == User.current.id ? 1 : 2)) - end - s = Trustie::Gitlab::Sync.new - gid = User.find(shixun_member.user_id).try(:gid) - u = s.g.add_team_member(gshixun.id, gid, 40) # 3代表角色master - if u.blank? - raise("同步Gitlab数据失败") - end - end + # # 同步复制合作者,合作者加入到gitlab + # unless User.current.manager_of_shixun?(@shixun) + # ShixunMember.create!(:user_id => User.current.id, :shixun_id => new_shixun.try(:id), :role => 1) + # end + # @shixun.shixun_members.each do |shixun_member| + # if ShixunMember.where(:shixun_id => new_shixun.try(:id), :user_id => shixun_member.user_id).blank? + # ShixunMember.create!(:user_id => shixun_member.try(:user_id), :shixun_id => new_shixun.try(:id), + # :role => (shixun_member.try(:user_id) == User.current.id ? 1 : 2)) + # end + # s = Trustie::Gitlab::Sync.new + # gid = User.find(shixun_member.user_id).try(:gid) + # u = s.g.add_team_member(gshixun.id, gid, 40) # 3代表角色master + # if u.blank? + # raise("同步Gitlab数据失败") + # end + # end # 同步复制关卡 if @shixun.challenges.present? @shixun.challenges.each do |challenge| @@ -786,6 +801,8 @@ class ShixunsController < ApplicationController return end Subject.where(:id => @shixun.stage_shixuns.map(&:subject_id)).destroy_all + g = Gitlab.client + g.delete_project(@shixun.gpid) if @shixun.try(:gpid).present? @shixun.destroy respond_to do |format| format.html{ redirect_to shixuns_managements_path } diff --git a/app/controllers/stages_controller.rb b/app/controllers/stages_controller.rb index d653d33a3..e5812e398 100644 --- a/app/controllers/stages_controller.rb +++ b/app/controllers/stages_controller.rb @@ -39,7 +39,7 @@ class StagesController < ApplicationController @stage.name = params[:stage_name] @stage.description = params[:stage_des] ActiveRecord::Base.transaction do - if @stage.save && params[:shixun_id] + if @stage.save begin @stage.stage_shixuns.destroy_all params[:shixun_id].each do |shixun_id| diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2a73e648e..d684943db 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -400,6 +400,9 @@ class UsersController < ApplicationController comment.root_id = reply.root_id reply.children << comment @is_project = params[:is_project] if params[:is_project] + + redirect_to message_replies_board_message_path(@root, :board_id => @root.board_id, :user_activity_id => params[:user_activity_id]) + return when 'BlogComment' @root = reply.root comment = BlogComment.new diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 78c0920a3..b8ed26ba7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -237,7 +237,7 @@ module ApplicationHelper # 实训语言的种类 def shixun_language - ["Java", "C", "C++", "Python2.7", "Python3.6", "MySQL/Java", "Html", "JFinal", "Docker", "Ethereum", "Dynamips", "MachineLearning", "verilog"] + ["Java", "C", "C++", "Python2.7", "Python3.6", "MySQL/Java", "Html", "JFinal", "Docker", "Ethereum", "Dynamips", "MachineLearning", "Verilog","Spark","MySQL/Python3.6"] end # 实训试用专业 @@ -4833,15 +4833,15 @@ def get_hw_index(hw,is_teacher,type=0) homework_commons = hw.course.homework_commons if is_teacher if type != 0 - homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("created_at asc") + homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("publish_time desc") else - homeworks = homework_commons.order("created_at asc") + homeworks = homework_commons.order("publish_time desc") end else if type != 0 - homeworks = homework_commons.where("homework_commons.homework_type = #{type} and publish_time <= '#{Time.now}'").order("created_at asc") + homeworks = homework_commons.where("homework_commons.homework_type = #{type} and publish_time <= '#{Time.now}'").order("publish_time desc") else - homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc") + homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("publish_time desc") end end hw_ids = homeworks.map{|hw| hw.id} if !homeworks.blank? diff --git a/app/views/challenges/_single_or_multiple_question.html.erb b/app/views/challenges/_single_or_multiple_question.html.erb index e0c883739..e066ccea3 100644 --- a/app/views/challenges/_single_or_multiple_question.html.erb +++ b/app/views/challenges/_single_or_multiple_question.html.erb @@ -349,6 +349,7 @@ var lens = contents.length; for(var i = 0; i < lens; i++){ if($(contents[i]).val().trim() == ""){ + $(contents[i]).focus(); return true; } } @@ -358,6 +359,7 @@ // 判断选择题选择答案的个数 function judge_choice_answer(){ var answer = document.getElementsByName("choice[answer][]"); + var contents = document.getElementsByName("question[cnt][]"); var lens = answer.length; var num = 0; for(var i= 0; i < lens; i++){ @@ -365,6 +367,7 @@ num += 1; } } + $(contents[0]).focus(); return num; } @@ -438,6 +441,7 @@ if(st == "1"){ if(judge_choice_contents()) { error.html("选项内容不能为空").show(); + }else if(choice_num() < 2){ error.html("单选题选项不能少于2个").show(); }else if(judge_choice_answer() == 0){ diff --git a/app/views/exercise/_edit_MC.html.erb b/app/views/exercise/_edit_MC.html.erb index 6d49b607d..1a9e536fa 100644 --- a/app/views/exercise/_edit_MC.html.erb +++ b/app/views/exercise/_edit_MC.html.erb @@ -56,55 +56,9 @@

温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案 保存 - 取消 + 取消

-<% if false %> -
-
- - 分 - <%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> - 标准答案: -
-
-
- - - -
- -
- -
- - -
-
- -<% end%> <% end%> \ No newline at end of file diff --git a/app/views/exercise/_edit_MCQ.html.erb b/app/views/exercise/_edit_MCQ.html.erb index bf6d672f1..3784bb800 100644 --- a/app/views/exercise/_edit_MCQ.html.erb +++ b/app/views/exercise/_edit_MCQ.html.erb @@ -25,7 +25,6 @@

多选题

-
@@ -62,57 +61,9 @@

温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案 保存 - 取消 + 取消

-<% if false %> -
-
- - 分 - <%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> - 标准答案: -
-
-
- - - -
- -
- -
- -
-
- - <% end %> <% end%> \ No newline at end of file diff --git a/app/views/exercise/_edit_multi.html.erb b/app/views/exercise/_edit_multi.html.erb index e56fa4c32..c5739c7a0 100644 --- a/app/views/exercise/_edit_multi.html.erb +++ b/app/views/exercise/_edit_multi.html.erb @@ -10,7 +10,6 @@

简答题

-
  • @@ -28,40 +27,8 @@ 温馨提示:[简答题]属于主观题需要人工评分,未作答的情况下系统将自动评分   参考答案仅作为人工评分的参考 保存 - 取消 + 取消

  • - -<% if false %> -
    -
    - - 分 -
    -
    -
    - - - -
    - -
    -
    - - -
    -
    -
    - -
    -
    - -<% end%> <% end%> \ No newline at end of file diff --git a/app/views/exercise/_edit_single.html.erb b/app/views/exercise/_edit_single.html.erb index 42f2735fe..46e663ffe 100644 --- a/app/views/exercise/_edit_single.html.erb +++ b/app/views/exercise/_edit_single.html.erb @@ -24,7 +24,6 @@

    填空题

  • - @@ -51,7 +50,7 @@

    温馨提示:[填空题]属于客观题将由系统自动评分,请设置标准答案 保存 - 取消 + 取消

  • diff --git a/app/views/exercise/_exercises_list.html.erb b/app/views/exercise/_exercises_list.html.erb index ed1030a52..3de19a9a3 100644 --- a/app/views/exercise/_exercises_list.html.erb +++ b/app/views/exercise/_exercises_list.html.erb @@ -16,13 +16,31 @@

    创建于<%=time_from_now exercise.created_at %> 更新于<%=time_from_now exercise.updated_at %> - <%= exercise.exercise_users.where("commit_status = 1").count %>已答 - <%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %>未答 - <%# count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %> - <%= un_commit_num exercise %>未评 - <%= ex_curr_status[:time] %> - <% if exercise.try(:exercise_status) == 0 && exercise.publish_time %> + <% if exercise.try(:exercise_status) > 1 %> + <% if @is_teacher %> + + <%= link_to exercise.exercise_users.where("commit_status = 1").count, student_exercise_list_exercise_path(exercise, :ex_status => ['1']), :class => "color-orange05 mr3", :target =>"_blank" %> + 已答 + + <%= link_to (exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count), student_exercise_list_exercise_path(exercise, :ex_status => ['0']), :class => "color-orange05 mr3", :target =>"_blank" %> + 未答 + <%# count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %> + + <%= link_to un_commit_num(exercise), student_exercise_list_exercise_path(exercise, :ex_comment => ['0']), :class => "color-orange05 mr3", :target =>"_blank" %> + 未评 + <% else %> + + <%= link_to exercise.exercise_users.where("commit_status = 1").count, student_exercise_list_exercise_path(exercise), :class => "color-orange05 mr3", :target =>"_blank" %> + 已答 + + <%= link_to (exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count), student_exercise_list_exercise_path(exercise), :class => "color-orange05 mr3", :target =>"_blank" %> + 未答 + <% end %> + <% end %> + <% if exercise.try(:exercise_status) == 1 && exercise.publish_time %> 将于 <%= format_time(exercise.publish_time).to_s %> 发布 + <% else %> + <%= ex_curr_status[:time] %> <% end %>

    @@ -42,7 +60,7 @@ <% end %> -
  • 删除
  • +
  • 删除
  • <% end %> diff --git a/app/views/exercise/_show_multi.html.erb b/app/views/exercise/_show_multi.html.erb index de1ee620b..0dfcb53d9 100644 --- a/app/views/exercise/_show_multi.html.erb +++ b/app/views/exercise/_show_multi.html.erb @@ -15,8 +15,8 @@
    <%= exercise_question.question_title %>
    -

    参考答案

    -

    <%= exercise_question.exercise_standard_answers.count > 0 ? exercise_question.exercise_standard_answers.first.answer_text : "无"%>

    +

    参考答案:

    +
    <%= exercise_question.exercise_standard_answers.count > 0 ? exercise_question.exercise_standard_answers.first.answer_text : "无"%>
    diff --git a/app/views/games/_game_choose_results.html.erb b/app/views/games/_game_choose_results.html.erb index f212f1f3f..3ab0f6e29 100644 --- a/app/views/games/_game_choose_results.html.erb +++ b/app/views/games/_game_choose_results.html.erb @@ -1,7 +1,10 @@ @@ -60,4 +63,33 @@ +
    +
    +
    +
    +
    + <% unless @game.choose_correct_num == nil %> + <% if @game.choose_correct_num != game_challenge.challenge_chooses.count %> +

    + <%= @game.choose_correct_num %>/<%= game_challenge.challenge_chooses.count %>共有<%= game_challenge.challenge_chooses.count %>题,其中有<%= game_challenge.challenge_chooses.count - @game.choose_correct_num %>题结果不匹配。 +

    + <% else %> +

    + <%= game_challenge.challenge_chooses.count %>/<%= game_challenge.challenge_chooses.count %> 全部通过 +

    + <% end %> + <% end %> +
    +
    +
      +
    • 选择题:<%= @game.choose_correct_num.nil? ? 0 : @game.choose_correct_num %>/<%= game_challenge.challenge_chooses.count %>
    • +
    • 经验值:+ <%= @final_score %>
    • +
    • 金币:+ <%= @final_score %>
    • +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/homework_common/_homework_index_list.html.erb b/app/views/homework_common/_homework_index_list.html.erb index 55aeb3e07..45c197d31 100644 --- a/app/views/homework_common/_homework_index_list.html.erb +++ b/app/views/homework_common/_homework_index_list.html.erb @@ -58,10 +58,11 @@ <% end %> <% end %> - <%= homework_curr_status[:time] %> <% if homework_common.homework_detail_manual.try(:comment_status) == 0 && homework_common.publish_time %> 将于 <%= format_time(homework_common.publish_time).to_s %> 发布 - <% end %> + <% else %> + <%= homework_curr_status[:time] %> + <% end %>

    <% if @is_teacher %> diff --git a/app/views/managements/_classroom_list.html.erb b/app/views/managements/_classroom_list.html.erb index 0d6192326..dc321ffa0 100644 --- a/app/views/managements/_classroom_list.html.erb +++ b/app/views/managements/_classroom_list.html.erb @@ -23,7 +23,7 @@ - <%= courselist.name %> + <%= courselist.name %> <%= courselist.courses.count %> diff --git a/app/views/shixuns/_monitor_tip.html.erb b/app/views/shixuns/_monitor_tip.html.erb index bb427fb4e..aceb016f1 100644 --- a/app/views/shixuns/_monitor_tip.html.erb +++ b/app/views/shixuns/_monitor_tip.html.erb @@ -8,9 +8,12 @@ <% if result %> <% if @status == 0 %> 已发布过申请,请等待管理员审核 - <% else %> + <% elsif @status == 1 %> 发布申请已提交,请等待管理员的审核
    • 我们将在1-2个工作日内完成审核 + <% else %> + 每一个关卡至少需要一个技能标签
    + 第<%= @position %>尚未设置技能标签,请补充 <% end %> <% else %> 实训云平台繁忙(繁忙等级:80) diff --git a/app/views/shixuns/publish.js.erb b/app/views/shixuns/publish.js.erb index b4099d3ae..90ccba95a 100644 --- a/app/views/shixuns/publish.js.erb +++ b/app/views/shixuns/publish.js.erb @@ -1,4 +1,4 @@ -<% unless @status && @status = 1 %> +<% unless @status && @status == 1 %> $("#apply_publish_shixun").attr("data-option", 1); $("#apply_publish_shixun").removeClass("disabled-grey-bg"); <% end %> diff --git a/app/views/subjects/edit.html.erb b/app/views/subjects/edit.html.erb index 0f8baf4e9..845ad9424 100644 --- a/app/views/subjects/edit.html.erb +++ b/app/views/subjects/edit.html.erb @@ -1,6 +1,5 @@ -<% content_for :header_tags do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> -<% end %> +<%= stylesheet_link_tag '/editormd/css/editormd' %> +<%= javascript_include_tag '/editormd/editormd' %>

    @@ -9,40 +8,28 @@

    - 编辑实训路径 -
    + 编辑实训路径 +
    - <%= labelled_form_for @subject do |f| %> -
  • - - -
    - 请输入名称 -
  • - + <%= labelled_form_for @subject do |f| %> +
  • + + +
    + 请输入名称 +
  • + - +
  • <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %> - - <%= f.kindeditor :description, :editor_id => 'subject_description_editor', - :owner_id => @subject.nil? ? 0: @subject.id, - :owner_type => OwnerTypeHelper::SUBJECT, - :local_storage_mdu => "subject_description_#{User.current.id}_#{@subject.id}", - :local_storage_id => "desc", - :width => '80%', - :height => 200, - :minHeight=>200, - :placeholder => "请在此输入实训路径的简介", - :class => 'talk_text fl', - :input_html => { :id => 'new_subject_description', - :class => 'talk_text fl', - :maxlength => 5000 } - %> +
    + +

    @@ -50,32 +37,116 @@
  • - - <%= f.kindeditor :learning_notes, :editor_id => 'subject_learning_notes_editor', - :owner_id => @subject.nil? ? 0: @subject.id, - :owner_type => OwnerTypeHelper::SUBJECT, - :local_storage_mdu => "subject_notes_#{User.current.id}_#{@subject.id}", - :local_storage_id => "notes", - :width => '80%', - :height => 200, - :minHeight=>200, - :placeholder => "请在此输入实训路径的学习须知", - :class => 'talk_text fl', - :input_html => { :id => 'new_learning_notes', - :class => 'talk_text fl', - :maxlength => 5000 } - %> +
    + +

    请输入学习须知
  • -
  • - - <%= link_to "取消", subject_path(@subject), :class => "task-btn fl mr10 ml20" %> - 保存 -
  • - <% end %> +
  • + + <%= link_to "取消", subject_path(@subject), :class => "task-btn fl mr10 ml20" %> + 保存 +
  • + <% end %> +
    - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/subjects/new.html.erb b/app/views/subjects/new.html.erb index 42b2382d2..cfa6ae8ea 100644 --- a/app/views/subjects/new.html.erb +++ b/app/views/subjects/new.html.erb @@ -1,6 +1,6 @@ -<% content_for :header_tags do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> -<% end %> +<%= stylesheet_link_tag '/editormd/css/editormd' %> +<%= javascript_include_tag '/editormd/editormd' %> +

    @@ -9,81 +9,57 @@

    - 新建实训路径 -
    + 新建实训路径 +
    - <%= labelled_form_for @subject do |f| %> -
  • - - -
    - 请输入名称 -
  • - + <%= labelled_form_for @subject do |f| %> +
  • + + +
    + 请输入名称 +
  • + - -
  • - - <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %> - - <%= f.kindeditor :description, :editor_id => 'subject_description_editor', - :owner_id => @subject.nil? ? 0: @subject.id, - :owner_type => OwnerTypeHelper::SUBJECT, - :local_storage_mdu => "subject_description_#{User.current.id}", - :local_storage_id => "desc", - :width => '80%', - :height => 200, - :minHeight=>200, - :placeholder => "请在此输入实训路径的简介", - :class => 'talk_text fl', - :input_html => { :id => 'new_subject_description', - :class => 'talk_text fl', - :maxlength => 5000 } - %> -
    -

    -

    - 请输入简介 -
  • -
  • - - - <%= f.kindeditor :learning_notes, :editor_id => 'subject_learning_notes_editor', - :owner_id => @subject.nil? ? 0: @subject.id, - :owner_type => OwnerTypeHelper::SUBJECT, - :local_storage_mdu => "subject_notes_#{User.current.id}", - :local_storage_id => "notes", - :width => '80%', - :height => 200, - :minHeight=>200, - :placeholder => "请在此输入实训路径的学习须知", - :class => 'talk_text fl', - :input_html => { :id => 'new_learning_notes', - :class => 'talk_text fl', - :maxlength => 5000 } - %> - -
    -

    -

    - 请输入学习须知 -
  • - -
  • - - <%= link_to "取消", subjects_path(), :class => "task-btn fl mr10 ml20" %> - 保存 -
  • - <% end %> -
    -
    + +
  • + + <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %> +
    + +
    +
    +

    +

    + 请输入简介 +
  • +
  • + +
    + +
    + +
    +

    +

    + 请输入学习须知 +
  • + +
  • + + <%= link_to "取消", subjects_path(), :class => "task-btn fl mr10 ml20" %> + 保存 +
  • + <% end %> + + \ No newline at end of file + /* ------------------------------- 简介md ------------------------------*/ + var shixun_editormd = editormd("shixun_introduction", { + width : "80%", + height : 600, + syncScrolling : "single", + //你的lib目录的路径,我这边用JSP做测试的 + path : "/editormd/lib/", + tex : true, + toolbarIcons : function() { + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ] + }, + + toolbarCustomIcons : { + testIcon : "
    ", + testIcon1 : "
    " + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea : true, + autoFocus: false, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity : 0.6, + placeholder: "请在此输入实训路径的简介", + imageUpload : true, + imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], + imageUploadURL : "<%= upload_with_markdown_path(:container_id => @subject.id, :container_type => @subject.class) %>" //url + }); + + /* --------------------------------- 学习须知 -------------------------------------- */ + var shixun_propaedeutics = editormd("shixun_propaedeutics", { + width : "80%", + height : 600, + syncScrolling : "single", + //你的lib目录的路径,我这边用JSP做测试的 + path : "/editormd/lib/", + tex : true, + toolbarIcons : function() { + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ] + }, + toolbarCustomIcons : { + testIcon : "
    ", + testIcon1 : "
    " + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea : true, + autoFocus: false, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity : 0.6, + placeholder: "请在此输入实训路径的学习须知", + imageUpload : true, + imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], + imageUploadURL : "<%= upload_with_markdown_path(:container_id => @subject.id, :container_type => @subject.class) %>" //url + }); + window.onload = function(){ + console.log(shixun_editormd); + + $("#shixun_introduction [type=\"latex\"]").bind("click", function(){ + shixun_editormd.cm.replaceSelection("```latex"); + shixun_editormd.cm.replaceSelection("\n"); + shixun_editormd.cm.replaceSelection("\n"); + shixun_editormd.cm.replaceSelection("```"); + var __Cursor = shixun_editormd.cm.getDoc().getCursor(); + shixun_editormd.cm.setCursor(__Cursor.line-1, 0); + }); + + $("#shixun_propaedeutics [type=\"latex\"]").bind("click", function(){ + shixun_propaedeutics.cm.replaceSelection("```latex"); + shixun_propaedeutics.cm.replaceSelection("\n"); + shixun_propaedeutics.cm.replaceSelection("\n"); + shixun_propaedeutics.cm.replaceSelection("```"); + var __Cursor = shixun_propaedeutics.cm.getDoc().getCursor(); + shixun_propaedeutics.cm.setCursor(__Cursor.line-1, 0); + }); + + $("#shixun_introduction [type=\"inline\"]").bind("click", function(){ + shixun_editormd.cm.replaceSelection("$$$$"); + var __Cursor = shixun_editormd.cm.getDoc().getCursor(); + shixun_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2); + shixun_editormd.cm.focus(); + }); + + $("#shixun_propaedeutics [type=\"inline\"]").bind("click", function(){ + shixun_propaedeutics.cm.replaceSelection("$$$$"); + var __Cursor = shixun_propaedeutics.cm.getDoc().getCursor(); + shixun_propaedeutics.cm.setCursor(__Cursor.line, __Cursor.ch-2); + shixun_propaedeutics.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + }; + diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index 10208015c..4aea081d4 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -1,3 +1,6 @@ +<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %> +<%= javascript_include_tag '/editormd/lib/marked.min.js','/editormd/lib/prettify.min.js','/editormd/lib/raphael.min.js','/editormd/lib/underscore.min.js','/editormd/lib/sequence-diagram.min.js', + '/editormd/lib/flowchart.min.js','/editormd/lib/jquery.flowchart.min.js','/editormd/editormd.js'%>
    <% if !@subject.description.blank? || User.current.manager_of_subject?(@subject) %> @@ -8,8 +11,10 @@ <% end %>

    -
    -
    <%= @subject.description.blank? ? "暂未填写" : (@subject.description.html_safe) %>
    +
    +
    + +
    <% end %> @@ -142,7 +147,9 @@ <% end %>

    -
    <%= @subject.learning_notes.blank? ? "暂未填写" : @subject.learning_notes.html_safe %>
    +
    + +

    教学团队 @@ -176,6 +183,22 @@