Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop

This commit is contained in:
miss 2017-09-08 15:53:21 +08:00
commit 3a874f6cf1
54 changed files with 628 additions and 442 deletions

View File

@ -109,7 +109,9 @@ class AccountController < ApplicationController
if User.current.anonymous?
redirect_to signin_path
else
UserActions.create(:action_id => User.current.id, :action_type => "Logout", :user_id => User.current.id)
logout_user
# 记录用户登出行为
redirect_to signin_path
end
# display the logout form
@ -816,6 +818,8 @@ class AccountController < ApplicationController
call_hook(:controller_account_success_authentication_after, {:user => user })
code = /\d*/
# 记录用户登录行为
UserActions.create(:action_id => User.current.id, :action_type => "Login", :user_id => User.current.id)
#根据home_url生产正则表达式
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != ''

View File

@ -44,30 +44,29 @@ class CoursesController < ApplicationController
@user = User.current
@search = params[:search].nil? ? '' : params[:search]
@select = params[:select].nil? ? '' : params[:select]
@is_end = params[:is_end].nil? ? 0 : params[:is_end].to_i # 是否归档
@is_over = params[:is_over] # 是否是新建课程页面跳转的查看归档
@syllabuses_num = Course.where("is_end = #{@is_end} and is_delete = 0").count
@syllabuses_num = Course.where("is_end = 0 and is_delete = 0").count
#@syllabus_count = all_syllabuses.count
# 我创建的课堂
create_syllabuses = Course.where(:tea_id => @user.id)
# 我参与的课堂
join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}")
@join_syllabuses_count = join_syllabuses.where(:is_end => @is_end, :is_delete => 0).count
@create_syllabuses_count = create_syllabuses.where(:is_end => @is_end, :is_delete => 0).count
@join_syllabuses_count = join_syllabuses.where(:is_end => 0, :is_delete => 0).count
@create_syllabuses_count = create_syllabuses.where(:is_end => 0, :is_delete => 0).count
# 页面筛选的课程
if @select == "create"
@syllabuses = create_syllabuses.where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'")
@syllabuses = create_syllabuses.where("is_end = 0 and is_delete = 0 and name like '%#{@search}%'")
elsif @select == "join"
@syllabuses = join_syllabuses.where("is_end = #{@is_end} and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'")
@syllabuses = join_syllabuses.where("is_end = 0 and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'")
elsif @select == "end"
# 归档的课堂
end_syllabuses = Course.where("is_end = #{@is_end} and name like '%#{@search}%'")
end_syllabuses = Course.where("is_end = 1 and name like '%#{@search}%'")
@syllabuses = end_syllabuses
else
# 全部课堂
all_syllabuses = Course.where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'")
all_syllabuses = Course.where("is_end = 0 and is_delete = 0 and name like '%#{@search}%'")
@syllabuses = all_syllabuses
end
@ -1849,9 +1848,9 @@ class CoursesController < ApplicationController
#sheet1.row(0).default_format = blue
#sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
sheet1[0,0] = "课程编号"
sheet1[0,1] = course.syllabus.id
sheet1[0,1] = course.course_list_id
sheet1[1,0] = "课程名称"
sheet1[1,1] = course.syllabus.title
sheet1[1,1] = course.course_list_name
sheet1[2,0] = "班级编号"
sheet1[2,1] = course.id
sheet1[3,0] = "班级名称"
@ -1902,9 +1901,9 @@ class CoursesController < ApplicationController
homeworks.each_with_index do |home, i|
sheet = book.create_worksheet :name => "#{i+1}次作业"
sheet[0,0] = "课程编号"
sheet[0,1] = course.syllabus.id
sheet[0,1] = course.course_list_id
sheet[1,0] = "课程名称"
sheet[1,1] = course.syllabus.title
sheet[1,1] = course.course_list_name
sheet[2,0] = "班级编号"
sheet[2,1] = course.id
sheet[3,0] = "班级名称"

View File

@ -600,7 +600,7 @@ class FilesController < ApplicationController
attachment.save
resource_bank = ResourceBank.create(:course_id => @course.id, :attachment_id => attachment.id, :filename => attachment.filename, :disk_filename => attachment.disk_filename, :filesize => attachment.filesize, :digest => attachment.digest, :downloads => 0,
:user_id => attachment.author_id, :description => attachment.description, :disk_directory => attachment.disk_directory, :is_public => attachment.is_public, :copy_from => attachment.copy_from,
:quotes => 1, :applicable_syllabus => @course.syllabus.title, :major_level => @course.syllabus.major_level, :discipline_category_id => @course.syllabus.discipline_category_id, :first_level_discipline_id => @course.syllabus.first_level_discipline_id, :content_type => attachment.content_type)
:quotes => 1, :applicable_syllabus => @course.course_list_name, :content_type => attachment.content_type)
attachment.update_column('resource_bank_id', resource_bank.id)
end
end

View File

@ -3,7 +3,7 @@ class GamesController < ApplicationController
layout "base_myshixun"
skip_before_filter :verify_authenticity_token, :only => [:file_update]
before_filter :find_myshixun, :only => [:index]
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, :get_waiting_time,
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :prev_step,:outputs_show, :file_edit, :file_update, :get_waiting_time,
:game_status, :change_status, :answer, :minus_score, :refresh_game_list, :reset_original_code, :reset_new_code, :evaluating_choice]
before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update, :reset_original_code, :reset_new_code, :html_show]
before_filter :allowd_manager
@ -94,7 +94,7 @@ class GamesController < ApplicationController
@language = @game_challenge.shixun.language
error_position = had_test.blank? ? nil : had_test.select{|had_test| had_test.result == false}.last
logger.info("latest output id is #{error_position.id unless error_position.blank?}")
@latest_output = error_position.try(:out_put).gsub(/\n/, '<br />').gsub(/\t/, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;').to_json unless error_position.try(:out_put).blank?
@latest_output = error_position.try(:out_put).gsub(/\n/, '<br/>').gsub(/\t/, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;').to_json unless error_position.try(:out_put).blank?
logger.info(@latest_output)
respond_to do |format|
@ -163,7 +163,7 @@ class GamesController < ApplicationController
raise("实训云平台繁忙繁忙等级94")
end
render :json => {:result => "success", :onRun => res['onRun'], :waitNum => res['waitNum'], :waitingTime => res['waitingTime'], :resubmit => resubmit }
#render :json => {:result => "success", :onRun => 1, :waitNum => 12, :waitingTime => 546 }
#render :json => {:result => "success", :onRun => 0, :waitNum => 12, :waitingTime => 1234 }
rescue Exception => e
render :json => {:result => "failed"}
end
@ -278,6 +278,7 @@ class GamesController < ApplicationController
@final_score = ((@game.answer_open? || shixun.status <= 1) ? 0 : @game.final_score.to_i)
error_position = had_test.blank? ? nil : had_test.select{|had_test| had_test.result == false}.last
@latest_output = error_position.try(:out_put).gsub(/\n/, '<br/>').gsub(/\t/, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;') unless error_position.try(:out_put).blank?
logger.info("@compile_success###################{@compile_success}")
@language = game_challenge.shixun.language
render :json => {test_sets: total_test_sets,
test_sets_count: @test_sets_count,
@ -293,7 +294,9 @@ class GamesController < ApplicationController
had_done: had_done,
language: @language,
score: score,
tag_count: tag_count}
tag_count: tag_count,
position: game_challenge.position
}
end
# 选择题评测(选择题不需要重新评测)
@ -343,7 +346,7 @@ class GamesController < ApplicationController
if @game.outputs.blank?
Output.create(:game_id => @game.id, :actual_output => user_answer, :result => correct)
end
render :json => {correct: correct, had_done: had_done, :grade => User.where(:id => User.current.id).first.grade, score: score, tag_count: tag_count}
render :json => {correct: correct, had_done: had_done, :grade => User.where(:id => User.current.id).first.grade, score: score, tag_count: tag_count, position: @game_challenge.position}
end
@ -391,6 +394,13 @@ class GamesController < ApplicationController
end
end
def prev_step
prev_game = @game.prev_game
respond_to do |format|
format.js{ redirect_to myshixun_game_path(prev_game, :myshixun_id => @myshixun)}
end
end
# 获取答案,第一次查看需扣掉该关卡的积分
# 如果已看过,下次可以免费查看
# viewed 1: 直接查看 2弹框提示将要扣除积分确定后显示内容 3弹框提示分数不够
@ -504,10 +514,11 @@ class GamesController < ApplicationController
unless test_sets.blank?
test_sets.each do |test_set|
output = Output.where(:game_id => @game.id, :test_set_position => test_set.position).first
actual_output = (output.try(:actual_output).gsub(/\n/, '<br />').gsub(/\t/, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;') unless output.try(:actual_output).blank?)
actual_output = (output.try(:actual_output).gsub(/\n/, '<br/>').gsub(/\t/, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;') unless output.try(:actual_output).blank?)
result = output.try(:result)
compile_success = (actual_output.blank? || !actual_output.match(/error/).blank?) ? 0 : 1
public_result = {:is_public => (test_set.is_public ? 1 : 0), :result => result, :input => test_set.input,
:actual_output => actual_output, :output => test_set.output}
:actual_output => actual_output, :output => test_set.output, :compile_success => compile_success}
logger.info("1111#################################{public_result.to_json}")
test_result << public_result.to_json
end

View File

@ -5,6 +5,7 @@ class HomeworkCommonController < ApplicationController
layout "base_courses"
include StudentWorkHelper
include ApplicationHelper
before_filter :find_course, :only => [:index,:new,:create]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,
:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works,
@ -332,6 +333,15 @@ class HomeworkCommonController < ApplicationController
end
if @homework.homework_type == 4
if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation].to_i
@homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation].to_i
if @homework.end_time < Time.now
@homework.student_works.each do |student_work|
set_shixun_final_score @homework, student_work, @homework_detail_manual.answer_open_evaluation
student_work.save
end
end
end
@homework.score_open = params[:homework_score_open] ? 1 : 0
else
@homework.work_public = params[:homework_work_public] ? 1 : 0

View File

@ -109,16 +109,18 @@ class MyshixunsController < ApplicationController
resubmit = jsonTestDetails['resubmit']
outPut = tran_base64_decode64(jsonTestDetails['outPut'])
jenkins_testsets = jsonTestDetails['msg']
compile_success = jsonTestDetails['compileSuccess']
# message = Base64.decode64(params[:msg]) unless params[:msg].blank?
logger.info(outPut)
logger.info("##################"+ compile_success)
game = Game.find(game_id)
challenge = game.challenge
unless jenkins_testsets.blank?
jenkins_testsets.each do |j_test_set|
actual_output = tran_base64_decode64(j_test_set['output'])
game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'],
:actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index)
:actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index, :compile_success => compile_success.to_i)
logger.info("compile_success:"+ compile_success)
# output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first
# logger.info("#############{outPut}")
# if output.nil?

View File

@ -381,19 +381,31 @@ class ShixunsController < ApplicationController
redirect_to myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun)
return
end
repository = @shixun.repository
ActiveRecord::Base.transaction do
begin
@g = Gitlab.client
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
code = down_generate_identifier("myshixun")
myshixun = Myshixun.create!(:shixun_id => @shixun.id, :user_id => User.current.id, :identifier => code)
# fork版本库如果用户没有同步则先同步用户
g = Gitlab.client
if User.current.gid.nil?
s = Trustie::Gitlab::Sync.new
s.sync_user(User.current)
end
gshixun = @g.fork(@shixun.gpid, User.current.gid)
logger.info("#############gshixun is #{gshixun}")
if !gshixun.id.nil?
# 防止fork多次的问题
myshixun = copy_myshixun(@shixun, gshixun)
gshixun = g.fork(@shixun.gpid, User.current.gid)
if !gshixun.try(:id).blank?
myshixun.update_column(:gpid, gshixun.id) if myshixun.try(:gpid).blank? # 为了防止多次fork
rep = Repository.create!(:myshixun_id => myshixun.id, :identifier => gshixun.name,:project_id => -1, :shixun_id => -2)
rep.update_column(:type, "Repository::Gitlab")
rep_url = Base64.urlsafe_encode64(git_shixun_url_ip @shixun, "educoder") # 注意educoder为默认给实训创建版本库的用户如果换成别的用户名字要相应的修改
uri = "#{shixun_tomcat}/bridge/game/openGameInstance"
params = {tpiID: "#{myshixun.id}", tpmID: "#{@shixun.id}", instanceGitURL:rep_url, operationEnvironment:"#{@shixun.try(:language)}"}
logger.info("openGameInstance params is #{params}")
res = uri_exec uri, params
if (res && res['code'].to_i != 0)
raise("实训云平台繁忙繁忙等级83")
end
# 其它操作
challenges = @shixun.challenges
# 之所以增加user_id是为了方便统计查询性能
challenges.each_with_index do |challenge, index|
@ -420,7 +432,7 @@ class ShixunsController < ApplicationController
rescue Exception => e
flash[:error] = e.message
logger.info("failed to exec shixun: current task id is #{e}")
@g.delete_project(gshixun.id) if !gshixun.id.nil?
g.delete_project(gshixun.id) if !gshixun.id.nil?
redirect_to shixun_challenges_path(@shixun)
raise ActiveRecord::Rollback
end

View File

@ -267,6 +267,26 @@ module ApplicationHelper
end
end
# 已通过的关卡数 返回int类型(包含查看参考答案的)
def had_passed_changllenge_num shixun, user
myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => user.id).first
if myshixun.nil?
0
else
myshixun.games.select{|game| game.status == 2}.count
end
end
# 已通过的关卡数 返回int类型(未查看参考答案)
def had_passed_no_ans_changllenge_num shixun, user
myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => user.id).first
if myshixun.nil?
0
else
myshixun.games.select{|game| game.status == 2 && game.answer_open == 0}.count
end
end
# TPI状态 :已通关、未通关、未开启
def my_shixun_status shixun, user
status = ""
@ -4875,8 +4895,8 @@ end
def add_to_homework_bank_f homework
homework_bank = HomeworkBank.new(:name => homework.name, :description => homework.description, :user_id => User.current.id, :homework_type => homework.homework_type,
:quotes => 1, :is_public => homework.course.is_public, :applicable_syllabus => homework.course.syllabus.title, :homework_common_id => homework.id,
:reference_answer => homework.reference_answer, :syllabus_id => homework.course.syllabus_id)
:quotes => 1, :is_public => homework.course.is_public, :applicable_syllabus => homework.course.course_list_name, :homework_common_id => homework.id,
:reference_answer => homework.reference_answer, :course_list_id => homework.course.course_list_id)
if homework.homework_type == 2 && homework.homework_detail_programing
homework_bank.language = homework.homework_detail_programing.language
homework.homework_tests.each_with_index do |homework_test|
@ -5061,13 +5081,13 @@ def visable_course_homework course, type=0
if type != 0
homework_num = course.homework_commons.where(:homework_type => type).count
else
homework_num = course.homework_commons.count
homework_num = course.homework_commons.where(:homework_type => [1, 4]).count
end
else
if type != 0
homework_num = course.homework_commons.where(:homework_type => type).where("publish_time <= '#{Time.now}'").count
else
homework_num = course.homework_commons.where("publish_time <= '#{Time.now}'").count
homework_num = course.homework_commons.where("homework_type in '(1, 4)' and publish_time <= '#{Time.now}'").count
end
end
homework_num
@ -5198,6 +5218,17 @@ def set_final_score homework,student_work
end
end
# 实训作业的评分
def set_shixun_final_score homework, student_work, answer_open_evaluation
unless student_work.work_status == 0
shixun = homework.homework_commons_shixuns.shixun
passed_count = answer_open_evaluation ? had_passed_changllenge_num(shixun, student_work.user) : had_passed_no_ans_changllenge_num(shixun, student_work.user)
final_score =(passed_count.to_f / shixun.challenges.count) * 100
student_work.final_score = format("%.2f",final_score.to_f)
score = student_work.final_score - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
end
end
def quote_resource_bank resource, course
atta = Attachment.new(:filename => resource.filename, :disk_filename => resource.disk_filename, :filesize => resource.filesize, :digest => resource.digest, :downloads => 0, :is_publish => 0,

View File

@ -34,6 +34,11 @@ class Challenge < ActiveRecord::Base
Challenge.where(:position => (self.position + 1), :shixun_id => self.shixun).first
end
def prev_challenge
render_404 if self.position == 1
Challenge.where(:position => (self.position - 1), :shixun_id => self.shixun).first
end
def last_challenge
render_404 if self.position < 2
position = self.position - 1

View File

@ -46,6 +46,14 @@ class Game < ActiveRecord::Base
return game
end
def prev_game
challenge = self.challenge
prev_challenge_id = challenge.prev_challenge
game = Game.where(:myshixun_id => self.myshixun_id, :challenge_id => prev_challenge_id).first
render_404 if game.nil?
return game
end
# 获取game最新的一条输出结果
def latest_output
outputs = Output.where(:game_id => self.id).order("created_at desc")

View File

@ -126,7 +126,7 @@ class HomeworkCommon < ActiveRecord::Base
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
name = self.course.syllabus.nil? ? self.course.name : self.course.syllabus.title+""+self.course.name
name = self.course.course_list.nil? ? self.course.name : self.course.course_list_name+""+self.course.name
ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name}#{l(:label_new_homework_template)}", name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
end
end

View File

@ -1,7 +1,7 @@
#手动评分作业表
#comment_status: 0挂起 1提交2补交去掉3匿评中4申诉中5评阅中6已结束
class HomeworkDetailManual < ActiveRecord::Base
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id, :no_anon_penalty
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id, :no_anon_penalty, :answer_open_evaluation
belongs_to :homework_common
end

View File

@ -1,6 +1,6 @@
# status 1:完成实训
class Myshixun < ActiveRecord::Base
attr_accessible :description, :name, :parent_id, :user_id, :gpid, :forked_from, :visits, :is_public, :identifier
attr_accessible :description, :name, :parent_id, :user_id, :gpid, :forked_from, :visits, :is_public, :identifier, :shixun_id
# has_many :users, :through => :myshixun_members
has_many :myshixun_members, :dependent => :destroy
has_one :repository, :dependent => :destroy
@ -32,7 +32,7 @@ class Myshixun < ActiveRecord::Base
time = 0
self.games.each do |game|
if game.status == 2
time += (game.end_time -game.open_time).to_i > 0 ? (game.end_time -game.open_time).to_i : 0
time += (game.end_time.to_i - game.open_time.to_i) > 0 ? (game.end_time.to_i - game.open_time.to_i) : 0
end
end
time

View File

@ -1,6 +1,7 @@
class Output < ActiveRecord::Base
# attr_accessible :title, :body
# actual_output 编程题:实际输出, 选择题: 用户提交的答案(如: 014 对应用户选择为A B E
# compile_success 1 表示程序未报错,有正常输出, 0.表示程序抛异常了,报错!
default_scope :order => 'query_index desc'
belongs_to :game

View File

@ -56,7 +56,10 @@ class Repository < ActiveRecord::Base
'path_encoding',
'log_encoding',
'is_default',
'type'
'type',
'myshixun_id',
'shixun_id',
'project_id'
safe_attributes 'url',
:if => lambda {|repository, user| repository.new_record?}

View File

@ -13,7 +13,7 @@ class StudentWork < ActiveRecord::Base
# course's message
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
has_many :attachments, :dependent => :destroy
has_one :myshixun
belongs_to :myshixun
scope :has_committed, lambda{where("work_status != 0 and work_status != 3")}
scope :all_commit, lambda{where("work_status != 0")}
@ -51,7 +51,7 @@ class StudentWork < ActiveRecord::Base
#成绩计算
def set_final_score homework,student_work
if homework && homework.homework_detail_manual
if homework && homework.homework_type != 4 && homework.homework_detail_manual
if homework.homework_type != 2 #非编程作业
if homework.teacher_priority == 1 #教师优先
if student_work.teacher_score

View File

@ -584,7 +584,7 @@ class CoursesService
type = "review_class_member"
end
name = course.syllabus.nil? ? course.name : course.syllabus.title+""+course.name
name = course.course_list.nil? ? course.name : course.course_list_name+""+course.name
ws = WechatService.new
ws.class_notice user.id, type, course.id, title,name, user.show_name, format_time(Time.now), content, remark,uid
@ -689,7 +689,7 @@ class CoursesService
rolename = role_ids.include?("7") ? "助教" : "教师"
content = current_user.show_name + "申请以"+rolename+"身份加入班级,等待您的审批。"
name = course.syllabus.nil? ? course.name : course.syllabus.title+""+course.name
name = course.course_list.nil? ? course.name : course.course_list_name+""+course.name
ws = WechatService.new
ws.class_notice tea_user.id, "review_class_member", course.id, "班级成员审批通知。", name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情。",current_user.id
end

View File

@ -35,9 +35,7 @@
<li class="clearfix">
<p class="clearfix">
<span class="color-green fb">测试集<%= index + 1 %></span>
<% if test.is_public? %>
<i class="fa fa-unlock-alt font-grey ml5" ></i>
<% else %>
<% unless test.is_public? %>
<i class="fa fa-lock font-grey ml5" ></i>
<% end %>
</p>
@ -62,5 +60,14 @@
$("#edit_task_pass").click(function(){
$("#evaluating_edit").show();
$("#evaluating_show").hide();
// 设置textarea的宽度到140以后出现滚动条
var test_set_inputs = document.getElementsByName("test_set[input][]");
var test_set_outputs = document.getElementsByName("test_set[output][]");
if (test_set_inputs.length == test_set_outputs.length) {
for (var i = 0; i < test_set_inputs.length; i++) {
autoTextarea(test_set_inputs[i], 0, 140);
autoTextarea(test_set_outputs[i], 0, 140);
}
}
})
</script>

View File

@ -157,15 +157,6 @@
});
});
// 设置textarea的宽度到140以后出现滚动条
var test_set_inputs = document.getElementsByName("test_set[input][]");
var test_set_outputs = document.getElementsByName("test_set[output][]");
if (test_set_inputs.length == test_set_outputs.length) {
for (var i = 0; i < test_set_inputs.length; i++) {
autoTextarea(test_set_inputs[i], 0, 140);
autoTextarea(test_set_outputs[i], 0, 140);
}
}
// 判断测试集是否锁定, 0未锁定1锁定
function test_set_whether_lock(){
var lock = document.getElementsByName("test_set[lock][]");

View File

@ -58,9 +58,11 @@
<li class="fl <%= @tab == 3 ? "check_nav" : "" %>">
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 3) %>" class="color-black">参考答案</a>
</li>
<!-- <li class="fl <%#= @tab == 6 ? "check_nav" : "" %>">
<a href="<%#= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 6) %>" class="color-black">预备知识</a>
</li>-->
<% unless @challenge.ready_knowledge.blank? %>
<li class="fl <%= @tab == 6 ? "check_nav" : "" %>">
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 6) %>" class="color-black">背景知识</a>
</li>
<% end %>
<li class="fl <%= @tab == 4 ? "check_nav" : "" %>">
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 4) %>" class="color-black">评分设置</a>
</li>
@ -79,8 +81,8 @@
<%= render :partial => "edit_scoring" %>
<% elsif @tab == 5 %>
<%= render :partial => "edit_skill" %>
<%# elsif @tab == 6 %>
<%#= render :partial => "edit_propaedeutics" %>
<% elsif @tab == 6 %>
<%= render :partial => "edit_propaedeutics" %>
<% end %>
</div>
</div>

View File

@ -1,33 +1,17 @@
<form action="<%= courses_path(:select => @select, :is_end => @is_end) %>" data-remote="true" class="fr ml15" id="search_syllabuses_name" >
<form action="<%= courses_path(:select => @select) %>" data-remote="true" class="fr ml15" id="search_syllabuses_name" >
<div class="searchFor fr" style="margin-top: -3px">
<div class="searchCon">
<input type="text" class="searchinput" name="search" value="<%= @search %>" placeholder="请输入实训名称的关键字进行搜索" style="background: none;"/>
<i class="fa fa-close mr5 color-dark-grey" onclick="colse_searchbox();" title="搜索"></i>
</div>
<i class="fa fa-search mr5 color-dark-grey search_icon" onclick="search_shixun()" style="margin:10px" data-tip-down="搜索"></i>
<i class="fa fa-search mr5 color-dark-grey search_icon" onclick="$('#search_syllabuses_name').submit();" style="margin:10px" data-tip-down="搜索"></i>
</div>
</form>
<script>
//搜索实训
function search_shixun(){
if($(".searchCon").is(":visible")){
$("#search_syllabuses_name").submit();
} else{
$(".searchCon").show();
}
}
//关闭搜索框
//清空搜索框
function colse_searchbox(){
$('.searchCon').hide();
if($('.searchinput').val().trim() != ""){
$('.searchinput').val('');
$("#search_syllabuses_name").submit();
}
$('.searchinput').val('');
$("#search_syllabuses_name").submit();
}
$(function(){
<% if @search != "" %>
$(".searchCon").show();
<% end %>
});
</script>

View File

@ -13,10 +13,10 @@
</ul>
</div>
<div class="clearfix mb15 fl" style="width:100%;">
<a href="<%= courses_path(:select => "all", :is_end => @is_end,:search => @search) %>" id="courses_index_syllabuses_1" class="course_filtrate fl course_filtrate_bg" data-tab="all" data-remote="true">全部课堂</a>
<a href="<%= courses_path(:select => "create", :is_end => @is_end, :search => @search) %>" id="courses_index_syllabuses_2" class="course_filtrate fl" data-tab="create" data-remote="true">我管理的</a>
<a href="<%= courses_path(:select => "join", :is_end => @is_end, :search => @search) %>" id="courses_index_syllabuses_3" class="course_filtrate fl" data-tab="join" data-remote="true">我参与的</a>
<a href="<%= courses_path(:select => "end", :is_end => 1) %>" id="courses_index_syllabuses_4" class="course_filtrate fl" data-tab="end" data-remote="true">查看归档</a>
<a href="<%= courses_path(:select => "all",:search => @search) %>" id="courses_index_syllabuses_1" class="edu-filter-cir-grey mr20 active fl" data-tab="all" data-remote="true">全部课堂</a>
<a href="<%= courses_path(:select => "create", :search => @search) %>" id="courses_index_syllabuses_2" class="edu-filter-cir-grey mr20 fl" data-tab="create" data-remote="true">我管理的</a>
<a href="<%= courses_path(:select => "join", :search => @search) %>" id="courses_index_syllabuses_3" class="edu-filter-cir-grey mr20 fl" data-tab="join" data-remote="true">我参与的</a>
<a href="<%= courses_path(:select => "end") %>" id="courses_index_syllabuses_4" class="edu-filter-cir-grey fl" data-tab="end" data-remote="true">查看归档</a>
<!-- <li class="edu-dropdown fl ml15 mr5" id="thirdly_select" style="width: 100px">
<a href="javascript:void(0);" class="edu-dropdown-toggle" id="all_syllabuses" >所有课程<i class="fa fa-caret-down ml20"></i></a>
@ -43,10 +43,15 @@
$(function(){
<% unless @is_over.blank? %>
$.ajax({
url: '<%= courses_path(:select => "end", :is_end => 1) %>',
url: '<%= courses_path(:select => "end") %>',
dataType: 'script'
});
<% end %>
$(".edu-filter-cir-grey").live("click", function(){
$(this).addClass("active");
$(this).siblings().removeClass("active");
});
});
/* ------------------- 添加或取消收藏 ---------------------- */

View File

@ -1,14 +1,3 @@
$("#intelligence_course_list").html("<%= j(render :partial => "courses/courseList") %>");
$("#courses_index_syllabuses_1").attr('href', '<%= courses_path(:select => "all", :is_end => @is_end, :search => @search) %>');
$("#courses_index_syllabuses_2").attr('href', '<%= courses_path(:select => "create", :is_end => @is_end, :search => @search) %>');
$("#courses_index_syllabuses_3").attr('href', '<%= courses_path(:select => "join", :is_end => @is_end, :search => @search) %>');
<% if params[:select] == "end" %>
// $("#courses_index_syllabuses_4").hide();
// $("#courses_index_syllabuses_5").show();
<% elsif params[:select] == "return" %>
// $("#courses_index_syllabuses_4").show();
// $("#courses_index_syllabuses_5").hide();
<% end %>
$("#all_syllabuses").html("<%= @syllabuses_num %>");
$("#my_syllabuses").html("<%= @join_syllabuses_count + @create_syllabuses_count %>");
$("#search_syllabuses_name").replaceWith("<%= j(render :partial => 'course_index_search') %>");

View File

@ -2,9 +2,8 @@
<p style="line-height: 2.0;">
<i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to User.current.show_real_name, user_path(User.current) %> > <%= link_to '在线课堂', courses_path %> > <%= link_to '新建课堂' %>
</p>
<div class="user_bg_shadow bor-grey-e">
<div class="user_bg_shadow mt10 bor-grey-e">
<div class="edu-con-top ">
<span class="ml15 color-grey font-16">新建课堂</span>
</div>
@ -83,41 +82,62 @@
</div>
<script>
$(function(){
$("#new_course_list").on('input', function(e){
throttle(search_course_list, window, e);
});
$("#new_course_list").on('blur', function(e){
$("#new_course_name").val($("#new_course_list").val());
});
$("#new_course_list").on('focus', function (e) {
if ($("#new_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。
return;
} else{
search_course_ajax('');
}
});
//var date = new Date();//获取当前时间
//var nextDate = new Date(date.getTime() + 24*60*60*1000);//设置天数 +1 天
$('#new_course_end_date').datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d',
formatDate:'Y-m-d',
timepicker:false,
validateOnBlur:false
});
$(function(){
var course_list_name = "";
$('#new_course_end_date').datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d',
formatDate:'Y-m-d',
timepicker:false,
validateOnBlur:false
});
$(".course_list_ul").on('click', 'p',function(event) {
$("#new_course_list").val($(this).html());
$("#new_course_name").val($("#new_course_list").val());
$(".course_list_ul").hide();
event.stopPropagation();
});
$("body").click(function(event){
$(".course_list_ul").hide();
event.stopPropagation();
});
$("body").click(function(event){
$(".course_list_ul").hide();
event.stopPropagation();
});
$("#new_course_list").on('input', function(e){
throttle(search_course_list, window, e);
});
$("#new_course_list").on('blur', function(e){
if($("#new_course_name").val() == ""){
$("#new_course_name").val($("#new_course_list").val());
} else{
if($("#new_course_name").val().indexOf(course_list_name) == 0){
$("#new_course_name").val($("#new_course_name").val().replace(course_list_name, $("#new_course_list").val()));
} else{
$("#new_course_name").val($("#new_course_list").val() + $("#new_course_name").val());
}
}
regex_course_name('new');
course_list_name = $("#new_course_list").val();
});
$("#new_course_list").on('click', function (e) {
if ($("#new_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。
event.stopPropagation();
return;
} else{
search_course_ajax('');
event.stopPropagation();
}
});
$(".course_list_ul").on('click', 'p', function(event) {
$("#new_course_list").val($(this).html());
if($("#new_course_name").val() == ""){
$("#new_course_name").val($("#new_course_list").val());
} else{
if($("#new_course_name").val().indexOf(course_list_name) == 0){
$("#new_course_name").val($("#new_course_name").val().replace(course_list_name, $("#new_course_list").val()));
} else{
$("#new_course_name").val($("#new_course_list").val() + $("#new_course_name").val());
}
}
regex_course_name('new');
$(".course_list_ul").hide();
course_list_name = $(this).html();
event.stopPropagation();
});
});
</script>

View File

@ -128,33 +128,30 @@
</div>
<script>
var course_list_name = "";
$(function () {
$("#edit_course_list").on('input', function(e){
throttle(search_course_list, window, e);
});
$("#edit_course_list").on('focus', function (e) {
if ($("#edit_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。
return;
} else{
search_course_ajax('');
}
});
$("#edit_course_list").on('blur', function(e){
$("#edit_course_name").val($("#edit_course_list").val());
$("body").click(function(event){
$(".course_list_ul").hide();
//event.stopPropagation();
});
$(".course_list_ul").on('click', 'p',function(event) {
$("#edit_course_list").val($(this).html());
$("#edit_course_name").val($("#edit_course_list").val());
if($("#edit_course_name").val() == ""){
$("#edit_course_name").val($("#edit_course_list").val());
} else{
if($("#edit_course_name").val().indexOf(course_list_name) == 0){
$("#edit_course_name").val($("#edit_course_name").val().replace(course_list_name, $("#edit_course_list").val()));
} else{
$("#edit_course_name").val($("#edit_course_list").val() + $("#edit_course_name").val());
}
}
regex_course_name('edit');
$(".course_list_ul").hide();
course_list_name = $(this).html();
event.stopPropagation();
});
$("body").click(function(event){
$(".course_list_ul").hide();
//event.stopPropagation();
});
<% if @select_tab == 'member'%>
$(".stud-class-set .news .nav p[data-option='member']").click();
<% if @role && @role == 'as' %>

View File

@ -5,7 +5,7 @@
</li>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>
<span id="edit_syllabus_id"><%=@course.syllabus.title %></span>
<span id="edit_syllabus_id"><%#=@course.syllabus.title %></span>
<%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
<!--<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%#=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>-->
</li>

View File

@ -1,5 +1,5 @@
<span class="mt10 -flex c_grey ml15" id="time-consuming"></span>
<span class="mt10 mr15" style="color: #2dad96;" id="game_wating_time"></span>
<!--<span class="mt10 mr15" style="color: #2dad96;" id="game_wating_time"></span>-->
<% if @st == 0 %>
<div id="reset_code_to_bengin" class="<%= @game.status == 2 ? "" : "undis" %>">
<a href="javascript:void(0)" class="shixun-task-btn task-btn-green mr15 mt8" onclick="delete_confirm_box('<%= reset_new_code_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>', '你在本关中修改的内容将丢失<br />是否确定重新加载上次通过的代码');">加载上次通过的代码</a>
@ -12,6 +12,12 @@
<a href="javascript:void(0)" class="shixun-task-btn task-btn-blue mr15 mt8" onclick="choice_submmit();">评测</a>
<% end %>
</div>
<div id="prev_step_area">
<% if @game.challenge.position > 1 %>
<%= link_to "上一关 ", {:controller => 'games', :action => "prev_step", :id => @game, :myshixun_id => @myshixun},
:class => "shixun-task-btn task-btn-blue mr15 mt8", :id => "prev_step", :remote => true %>
<% end %>
</div>
<div id="code_estimate">
<% if @game.status == 1 %>
<a class="shixun-task-btn mt8 mr15" id="code_testing">评测中..</a>
@ -72,15 +78,6 @@
$("#time-consuming").html("耗时:" + days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ");
}
/* -----------------下一关增加loading效果--------------------- */
$("#next_step").live("click", function(){
if($("#next_step").attr("href") != "javascript:void(0);"){
nNext = $("#code_estimate");
html = "<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关<img src='/images/bigdata/loading2.svg' style='width:25px;float:left;margin-top: 3px' /></a>";
nNext.html(html);
}
});
// 选择题提交评测
// answer 选择的答案
function choice_submmit(){
@ -163,7 +160,11 @@
$("#code_estimate").html("<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关</a>");
} else if($("#exit_shixun").length > 0){
$("#code_estimate").html("<a href='javascript:void(0);' class='task-btn mr15 mt8'>退出实训</a>");
}$(".blacktab_con").eq(1).trigger("click"); // 回到测试结果页面
}
if($("#prev_step").length > 0){
$("#prev_step_area").html("<a href='javascript:void(0);' class='task-btn mr15 mt8'>上一关</a>");
}
$(".blacktab_con").eq(1).trigger("click"); // 回到测试结果页面
// 保存版本库代码
var fileUpdateUrl = $("#current_repository_path").html();
$.ajax({
@ -221,7 +222,8 @@
data.had_passed_testsests_public_count,
data.final_score,
data.latest_output,
data.language
data.language,
data.compile_success
);
$("#blacktab_nav_1").trigger("click");
if(data.status == 2){
@ -251,6 +253,9 @@
}
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>";
$("#code_test").html(html); // 恢复评测
if(data.position > 1){
$("#prev_step_area").html("<a href='<%= prev_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='prev_step' data-remote='true'>上一关</a>")
}
var codeEstimate = $("#code_estimate").children("a").html();
if(codeEstimate == undefined){
return;

View File

@ -21,7 +21,7 @@
<script>
<%# test_sets测试集had_test_count输出集的个数test_sets_count测试集的个数had_passed_testsests_error_count测试集报错数test_sets_hidden_count隐藏测试集的个数 %>
<%# test_sets_public_count公开测试集的个人had_passed_testsests_hidden_count通过的隐藏集个数had_passed_testsests_public_count通过的公开测试集个数 %>
<%# final_score最终得分had_done通过的是否是最后一关latest_output最新的输出language实训的语言 %>
<%# final_score最终得分had_done通过的是否是最后一关latest_output最新的输出language实训的语言, @compile_success表示代码是否抛异常 %>
$(function(){
code_evaluation(
[<%= @test_sets.html_safe unless @test_sets.blank? %>],

View File

@ -16,7 +16,7 @@
<li id="tab_nav_1" class="tab_hover" onclick="HoverLi1(1);">
<a href="javascript:void(0);" class="tab_type" style="font-size: 16px">过关任务</a>
</li>
<% unless @shixun.propaedeutics.blank? %>
<% unless @myshixun.shixun.try(:propaedeutics).blank? %>
<li id="tab_nav_2" onclick="HoverLi1(2);">
<a href="javascript:void(0);" class="tab_type" style="font-size: 16px">背景知识</a>
</li>
@ -27,7 +27,7 @@
</li>
<% end %>
<li id="tab_nav_4">
<%= link_to '评论', shixun_discuss_shixun_path(@shixun), :class => "tab_type", :style => "font-size: 16px", :remote => true %>
<%= link_to '评论', shixun_discuss_shixun_path(@myshixun.shixun), :class => "tab_type", :style => "font-size: 16px", :remote => true %>
</li>
<span class="btn-cir-big fr mt8 mr15" >经验值:<%= @game_challenge.score %></span>
</ul>
@ -46,7 +46,7 @@
<div class="fit -scroll">
<div class="-layout-v -fit">
<div class="-flex -scroll task-padding16 panel-box-sizing new_li read_only" unselectable="on" id="game_ready_knowledge">
<textarea style="display:none;"><%= @shixun.propaedeutics %></textarea>
<textarea style="display:none;"><%= @myshixun.shixun.propaedeutics %></textarea>
</div>
</div>
</div>
@ -113,11 +113,12 @@
</div>
</div>
<!--按钮的操作-->
<div class="-layout-h -center -bg-grey-90 -grey-20 -bg-darkblack " style="height:48px; ">
<div class="-layout-h -center -bg-grey-90 -grey-20 -bg-darkblack" style="height:48px; ">
<div class="-flex -layout-h" id="game_operate_action">
<%= render :partial => "games/code_actions" %>
</div>
</div>
<div class="-bg-darkblack" style="color:#2dad96;padding-left:15px" id="game_wating_time"></div>
</div>
</div>

View File

@ -1,6 +1,46 @@
<div class="edu-con-top clearfix mb15">
<p class="ml15 fl">评分设置</p>
</div>
<% if @homework.homework_type == 4 %>
<div class="ml30 mr30 pb10">
<div class="clearfix pr">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10" style="width: 20%">查看参考答案后通过评测的任务</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input id="answer_open_evaluation_0" class="magic-radio fl mt6" type="radio" name="answer_open_evaluation" value="0" <%= @homework_detail_manual.answer_open_evaluation ? '' : 'checked' %>>
<label for="answer_open_evaluation_0" class="fl mt6 mr30">零分</label>
<input id="answer_open_evaluation_1" class="magic-radio fl mt6" type="radio" name="answer_open_evaluation" value="1" <%= @homework_detail_manual.answer_open_evaluation ? 'checked' : '' %>>
<label for="answer_open_evaluation_1" class="fl mt6">满分</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>零分:查看参考答案才完成的任务,在系统评分时属于未完成任务<br/>
零分:查看参考答案才完成的任务,在系统评分时属于已完成任务 <br/>
</p>
</div>
</li>
<li class="clearfix mt10">
<label class="panel-form-label fl mr10">最终成绩组成</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">系统评分</label>
<input type="text" disabled class="fl task-form-15 task-height-40 panel-box-sizing" value="100%" placeholder="100%" />
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>系统评分是根据学生的任务完成情况,按照百分比计算 <br/>
例如实训任务5关学生A完成3关则最终成绩为 3 / 5 * 100 = 60分 <br/>
注意:学生完成实训后,必须关联实训项目,否则成绩为零
</p>
</div>
</li>
</ul>
</div>
</div>
<% else %>
<div class="ml30 mr30">
<div class="clearfix">
<ul>
@ -122,4 +162,5 @@
</li>
</ul>
</div>
</div>
</div>
<% end %>

View File

@ -1,124 +1,164 @@
<div class="edu-con-top clearfix mb15">
<p class="ml15 fl">评分设置</p>
</div>
<div class="ml30 mr30">
<div class="clearfix">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10">助教评分</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" disabled type="radio" <%= @homework_detail_manual.ta_mode == 1 ? 'checked' : '' %>>
<label>普通模式</label>
</span>
<span class="fl color-grey">(选中则取各助教最终评分的平均分)</span>
</li>
<li class="clearfix ">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" disabled type="radio" <%= @homework_detail_manual.ta_mode == 0 ? 'checked' : '' %>>
<label>复审模式</label>
</span>
<span class="fl color-grey">(选中则只取最终次的助教评分)</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">最终成绩组成</label>
</li>
<li class="clearfix edu-position">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" type="radio" disabled <%= @homework_detail_manual.final_mode ? '' : 'checked' %>>
<label>多项评分配比</label>
</span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<% if @homework.homework_type != 2 %>
<p>计算说明:<br/>
教师评分 * 其百分比 + 助教评分 * 其百分比 + 学生匿评平均分 * 其百<br/>分比 - ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )<br/>
注意:<br/>
非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到<br/>另外的评分选项上。例如教师评分40% + 助教评分35% + 学生匿<br/>评25%学生A没有得到教师评分则最终成绩将按照助教评分55%<br/> + 学生匿评45%进行计算
</p>
<% else %>
<p>计算说明:<br/>
教师评分 * 其百分比 + 助教评分 * 其百分比 + 系统评分 * 其百分比 <br/>+ 学生匿评平均分 * 其百分比 - ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规<br/>匿评扣分 * 违规匿评数 )
注意:<br/>
非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到<br/>另外的评分选项上。例如教师评分30% + 助教评分30% + 系统评<br/>分20% + 学生匿评20%学生A没有得到教师评分则最终成绩将按照<br/>助教评分40% + 系统评分30% + 学生匿评30%进行计算
</p>
<% end %>
</div>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">教师评分</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= (@homework_detail_manual.te_proportion * 100).to_i %>%" disabled>
</span>
</li>
<li class="clearfix ">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">助教评分</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= (@homework_detail_manual.ta_proportion * 100).to_i %>%" disabled>
</span>
</li>
<% if @homework.homework_type == 2 %>
<% if @homework.homework_type == 4 %>
<div class="ml30 mr30 pb10">
<div class="clearfix pr">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10" style="width: 20%">查看参考答案后通过评测的任务</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">系统评分</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= (@homework_detail_programing.ta_proportion * 100).to_i %>%" disabled>
</span>
<input class="magic-radio fl mt6" type="radio" disabled value="1" <%= @homework_detail_manual.answer_open_evaluation ? '' : 'checked' %>>
<label class="fl mt6 mr30">零分</label>
<input class="magic-radio fl mt6" type="radio" disabled value="0" <%= @homework_detail_manual.answer_open_evaluation ? 'checked' : '' %>>
<label class="fl mt6">满分</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>零分:查看参考答案才完成的任务,在系统评分时属于未完成任务<br/>
零分:查看参考答案才完成的任务,在系统评分时属于已完成任务 <br/>
</p>
</div>
</li>
<li class="clearfix mt10">
<label class="panel-form-label fl mr10">最终成绩组成</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">系统评分</label>
<input type="text" disabled class="fl task-form-15 task-height-40 panel-box-sizing" value="100%" placeholder="100%" />
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>系统评分是根据学生的任务完成情况,按照百分比计算 <br/>
例如实训任务5关学生A完成3关则最终成绩为 3 / 5 * 100 = 60分 <br/>
注意:学生完成实训后,必须关联实训项目,否则成绩为零
</p>
</div>
</li>
</ul>
</div>
</div>
<% else %>
<div class="ml30 mr30">
<div class="clearfix">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10">助教评分</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" disabled type="radio" <%= @homework_detail_manual.ta_mode == 1 ? 'checked' : '' %>>
<label>普通模式</label>
</span>
<span class="fl color-grey">(选中则取各助教最终评分的平均分)</span>
</li>
<li class="clearfix ">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" disabled type="radio" <%= @homework_detail_manual.ta_mode == 0 ? 'checked' : '' %>>
<label>复审模式</label>
</span>
<span class="fl color-grey">(选中则只取最终次的助教评分)</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">最终成绩组成</label>
</li>
<li class="clearfix edu-position">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" type="radio" disabled <%= @homework_detail_manual.final_mode ? '' : 'checked' %>>
<label>多项评分配比</label>
</span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<% if @homework.homework_type != 2 %>
<p>计算说明:<br/>
教师评分 * 其百分比 + 助教评分 * 其百分比 + 学生匿评平均分 * 其百<br/>分比 - ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )<br/>
注意:<br/>
非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到<br/>另外的评分选项上。例如教师评分40% + 助教评分35% + 学生匿<br/>评25%学生A没有得到教师评分则最终成绩将按照助教评分55%<br/> + 学生匿评45%进行计算
</p>
<% else %>
<p>计算说明:<br/>
教师评分 * 其百分比 + 助教评分 * 其百分比 + 系统评分 * 其百分比 <br/>+ 学生匿评平均分 * 其百分比 - ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规<br/>匿评扣分 * 违规匿评数 )
注意:<br/>
非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到<br/>另外的评分选项上。例如教师评分30% + 助教评分30% + 系统评<br/>分20% + 学生匿评20%学生A没有得到教师评分则最终成绩将按照<br/>助教评分40% + 系统评分30% + 学生匿评30%进行计算
</p>
<% end %>
</div>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">学生匿评</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= 100 - (@homework_detail_manual.te_proportion * 100).to_i - (@homework_detail_manual.ta_proportion * 100).to_i - (@homework_detail_programing.ta_proportion * 100).to_i%>%" disabled>
<label class="mr5">教师评分</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= (@homework_detail_manual.te_proportion * 100).to_i %>%" disabled>
</span>
</li>
<% else %>
<li class="clearfix">
<li class="clearfix ">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">学生匿评</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= 100 - (@homework_detail_manual.te_proportion * 100).to_i - (@homework_detail_manual.ta_proportion * 100).to_i %>%" disabled>
<label class="mr5">助教评分</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= (@homework_detail_manual.ta_proportion * 100).to_i %>%" disabled>
</span>
</li>
<% end %>
<li class="clearfix mt30 edu-position">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" type="radio" disabled <%= @homework_detail_manual.final_mode ? 'checked' : '' %>>
<label>单项评分优先</label>
</span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px; width:405px;">
<em></em>
<span></span>
<p>计算说明:<br/>
优先顺序排前的非零评分 * 100% - <br/>
( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
注意:<br/>
有教师评分则教师评分100%否则教辅评分100%,依次类推
</p>
</div>
</li>
<li class="clearfix mb50">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl ml25">
<% if @homework.homework_type == 2 %>
教师评分 → 教辅评分 → 系统评分 → 学生匿评评分
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">系统评分</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= (@homework_detail_programing.ta_proportion * 100).to_i %>%" disabled>
</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">学生匿评</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= 100 - (@homework_detail_manual.te_proportion * 100).to_i - (@homework_detail_manual.ta_proportion * 100).to_i - (@homework_detail_programing.ta_proportion * 100).to_i%>%" disabled>
</span>
</li>
<% else %>
教师评分 → 教辅评分 → 学生匿评评分
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">学生匿评</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= 100 - (@homework_detail_manual.te_proportion * 100).to_i - (@homework_detail_manual.ta_proportion * 100).to_i %>%" disabled>
</span>
</li>
<% end %>
</span>
</li>
</ul>
</div>
</div>
<li class="clearfix mt30 edu-position">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" type="radio" disabled <%= @homework_detail_manual.final_mode ? 'checked' : '' %>>
<label>单项评分优先</label>
</span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px; width:405px;">
<em></em>
<span></span>
<p>计算说明:<br/>
优先顺序排前的非零评分 * 100% - <br/>
( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
注意:<br/>
有教师评分则教师评分100%否则教辅评分100%,依次类推
</p>
</div>
</li>
<li class="clearfix mb50">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl ml25">
<% if @homework.homework_type == 2 %>
教师评分 → 教辅评分 → 系统评分 → 学生匿评评分
<% else %>
教师评分 → 教辅评分 → 学生匿评评分
<% end %>
</span>
</li>
</ul>
</div>
</div>
<% end %>
<script>
function score_cancel_edit(){
hideModal();

View File

@ -50,39 +50,12 @@
<% end %>
<div class="edu-con-bg01 mt15 user_bg_shadow" id="homework_score_setting">
<% if @homework.homework_type == 4 %>
<div class="edu-con-top clearfix mb15">
<p class="ml15 fl">评分设置</p>
</div>
<div class="ml30 mr30 pb10">
<div class="clearfix pr">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10">最终成绩组成</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">系统评分</label>
<input type="text" disabled class="fl task-form-15 task-height-40 panel-box-sizing" value="100%" placeholder="100%" />
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>系统评分是根据学生的任务完成情况,按照百分比计算 <br/>
例如实训任务5关学生A完成3关则最终成绩为 3 / 5 * 100 = 60分 <br/>
注意:学生完成实训后,必须关联实训项目,否则成绩为零
</p>
</div>
</li>
</ul>
</div>
</div>
<% else %>
<div class="<%= edit_mode ? 'none' : '' %>" id="show_score_setting">
<%= render :partial => 'show_score_setting' %>
</div>
<div class="<%= edit_mode ? '' : 'none' %>" id="edit_score_setting">
<%= render :partial => 'edit_score_setting' %>
</div>
<% end %>
<div class="<%= edit_mode ? 'none' : '' %>" id="show_score_setting">
<%= render :partial => 'show_score_setting' %>
</div>
<div class="<%= edit_mode ? '' : 'none' %>" id="edit_score_setting">
<%= render :partial => 'edit_score_setting' %>
</div>
</div>
<div class="edu-con-bg01 mt15 user_bg_shadow" id="homework_public_setting">
<div class="<%= edit_mode ? 'none' : '' %>" id="show_public_setting">

View File

@ -108,19 +108,14 @@
$(".inner-nav-user i").addClass("fa-sort-down mt10");
});
$("#header_keyword_search").live("click", function(){
function search_res(){
var keyword = $("input[name='search_keyword']").val(); // 搜索关键字
var index = $("#all_status_show_value").text(); // 搜索课程/项目
index = index == "课堂" ? 1 : 2;
// console.log("课堂" === index);
// console.log("实训" === index);
window.location.href = "<%= search_shixuns_or_courses_users_path %>" + "?search=" + keyword + "&index=" + index;
/* $.ajax({
url: "<%#= search_shixuns_or_courses_users_path %>",
data: {search: keyword, index:index},
dataType: "html"
});*/
});
}
$("#header_keyword_search").live("click", search_res);
// 如果是搜索的进来 保留搜索内容
<% if !@search.blank? && params[:action] == "search_shixuns_or_courses" %>
@ -129,5 +124,20 @@
$("#all_status_show_value").text("实训");
<% end %>
<% end %>
$("input[name='search_keyword']").on("keydown", function(event){
var code;
if (!event) {
event = window.event; //针对ie浏览器
code = event.keyCode;
}
else {
code = event.keyCode;
}
if(code == 13) {
search_res();
return false;
}
});
});
</script>

View File

@ -59,7 +59,7 @@
</div>
<% end %>
</div>
<% end %>
<% end %>
<div class="comment_content clearfix" onmouseover="$('#delete_reply_<%=activity.id %>_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=activity.id %>_<%=comment.id %>').hide();">
<div class="t_txt"><%= comment.content_detail.html_safe %></div>
<div class="">

View File

@ -316,27 +316,11 @@
$(".lesson_item").scrollTop(0);
$(".shou_up").hide();
$(".geng_down").show();
})
//点击搜索图标,显示搜索框
$(".search_icon").click(function(){
console.log($("#shixun_index_search_form").serialize());
if($(".searchCon").is(":visible")){
$.ajax({
url: '/shixuns/search',
type: 'post',
data: $("#shixun_index_search_form").serialize(),
remote: true,
success: function(data){
}
});
} else{
$(".searchCon").show();
}
})
});
});
$(".searchCon").on("keydown", "input[name='search']", function(event){
var target, code, tag;
var code;
if (!event) {
event = window.event; //针对ie浏览器
code = event.keyCode;
@ -352,34 +336,26 @@
//搜索实训
function search_shixun(){
console.log($("#shixun_index_search_form").serialize());
if($(".searchCon").is(":visible")){
$.ajax({
url: '/shixuns/search',
type: 'post',
data: $("#shixun_index_search_form").serialize(),
remote: true,
success: function(data){
}
});
} else{
$(".searchCon").show();
}
$.ajax({
url: '/shixuns/search',
type: 'post',
data: $("#shixun_index_search_form").serialize(),
remote: true,
success: function(data){
}
});
}
//关闭搜索框
function colse_searchbox(){
$('.searchCon').hide();
if($('.searchinput').val().trim() != ""){
$('.searchinput').val('');
$.ajax({
url: '/shixuns/search',
type: 'post',
data: $("#shixun_index_search_form").serialize(),
remote: true,
success: function(data){
}
});
}
$('.searchinput').val('');
$.ajax({
url: '/shixuns/search',
type: 'post',
data: $("#shixun_index_search_form").serialize(),
remote: true,
success: function(data){
}
});
}
// 新建实训

View File

@ -10,7 +10,7 @@
<div class="task-pm-box mt30 mb30 box_bg_shandow">
<div class="panel-header clearfix">
<h3 class="shixun_title fl mt5">背景知识</h3>
<% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %>
<% if User.current.manager_of_shixun?(@shixun) %>
<a href="JavaScript:void(0);" class="shixun-task-btn task-btn-green fr" id="edit_propaedeutics" style="margin: 5px 0;">编辑</a>
<% end %>
</div>

View File

@ -13,12 +13,12 @@
<%= student_work.work_status == 0 ? '--' : format_time(student_work.updated_at) %>
</td>
<td class="pr student_score_info">
<%= student_work.work_status == 0 ? '--' : had_passed_changllenge_count(shixun, student_work.user).to_s+"/"+shixun.challenges.count.to_s %>
<%= student_work.work_status == 0 ? '--' : had_passed_changllenge_num(shixun, student_work.user).to_s+"/"+shixun.challenges.count.to_s %>
<% if student_work.work_status != 0 %>
<div class="popup_tip_box-black" style="left:100px;">
<em></em>
<span></span>
<p>已通过<%= had_passed_changllenge_count(shixun, student_work.user) %>关,共<%= shixun.challenges.count %>关
<p>已通过<%= had_passed_changllenge_num(shixun, student_work.user) %>关,共<%= shixun.challenges.count %>关
</p>
</div>
<% end %>

View File

@ -22,8 +22,8 @@
<li>通关时间: <%= @myshixun.try(:status) == 1 ? (format_time @myshixun.done_time) : '- -' %></li>
</ul>
<ul class="fl edu-txt-w240">
<li>通关情况:<%= had_passed_changllenge_count(@shixun, @work.user).to_s+" / "+@shixun.challenges.count.to_s %></li>
<li>总耗时:<%=had_passed_changllenge_count(@shixun, @work.user) > 0 ? game_spend_time(total_spend_time @myshixun) : '- -' %></li>
<li>通关情况:<%= had_passed_changllenge_num(@shixun, @work.user).to_s+" / "+@shixun.challenges.count.to_s %></li>
<li>总耗时:<%=had_passed_changllenge_num(@shixun, @work.user) > 0 ? game_spend_time(@myshixun.total_spend_time) : '- -' %></li>
</ul>
</div>
<div class="edu-h200-auto" style="max-height:250px;">
@ -41,7 +41,7 @@
<tr>
<td>第<%= index + 1 %>关</td>
<!--<td>No.255</td>-->
<td><%= game.status == 2 ? game_spend_time((game.end_time - game.open_time).to_i) : '- -' %></td>
<td><%= game.status == 2 ? game_spend_time(game.end_time.to_i - game.open_time.to_i) : '- -' %></td>
<td><%= game.status == 2 ? game.final_score : '- -' %></td>
</tr>
<% end %>

View File

@ -21,7 +21,7 @@
<p class="clearfix title-line ml20 mr20">
<i class="fa fa-pause-circle color-light-green font-22 transform90 mr5"></i>
<span class="font-18 font-bd">第<%= s_index + 1 %>章&nbsp;&nbsp;<%= stage.name %></span>
<% if @subject.status == 0 && User.current.manager_of_subject?(@subject) %>
<% if User.current.manager_of_subject?(@subject) %>
<a href="javascript:void(0);" class="fr" onclick="edit_stage(<%= stage.id %>)"><i class="fa fa-pencil mt8 color-grey-c edit" data-tip-down="编辑"></i></a>
<a href="javascript:void(0);" class="fr" onclick="delete_confirm_box_2('<%= stage_path(stage) %>', '确定要删除该阶段吗?');"><i class="fa fa-trash mt8 mr10 color-grey-c delete" data-tip-down="删除"></i></a>
<% else %>
@ -74,7 +74,7 @@
<% if is_modify.blank? %>
<%= link_to "模拟实战", shixun_exec_shixun_path(shixun), :class => "task-btn task-btn-green ", :style=>"display: none", :id => "shixun_operation", :target => "_blank" %>
<% else %>
<a class="task-btn task-btn-green" onclick="sure_box_redirect('<%= myshixun_reset_myshixun_path(@myshixun) %>', '实训已经更新啦,系统正在为您重置');" style = "display: none" id = "shixun_operation">模拟实战</a>
<a class="task-btn task-btn-green" onclick="sure_box_redirect('<%= myshixun_reset_myshixun_path(myshixun) %>', '实训已经更新啦,系统正在为您重置');" style = "display: none" id = "shixun_operation">模拟实战</a>
<% end %>
<% end %>
<% end %>
@ -93,7 +93,7 @@
<% end %>
</div>
<% if @subject.status == 0 && User.current.manager_of_subject?(@subject) %>
<% if User.current.manager_of_subject?(@subject) %>
<div class="lesson-edit-content mb20">
<% if @stages.count == 0 %>
<%= form_for('', :url => {:controller => 'stages', :action => 'create', :subject => @subject.id}, :method => "post", :html => {:id => 'new_stage_form'}) do |f| %>

View File

@ -10,10 +10,10 @@
<%=link_to "全部", syllabuses_path(:tab => 1), :class => "tab_type", :remote => true %>
</li>
<li id="edu-tab-nav-2" class="new-tab-nav">
<%=link_to "我的发布", syllabuses_path(:tab => 2), :class => "tab_type", :remote => true %>
<%=link_to "我管理的", syllabuses_path(:tab => 2), :class => "tab_type", :remote => true %>
</li>
<li id="edu-tab-nav-3" class="new-tab-nav">
<%=link_to "我参与", syllabuses_path(:tab => 3), :class => "tab_type", :remote => true %>
<%=link_to "我参与", syllabuses_path(:tab => 3), :class => "tab_type", :remote => true %>
</li>
</ul>
<div class="cl"></div>

View File

@ -5,7 +5,7 @@
<% @shixuns.each do |shixun| %>
<div class=" clearfix edu-class-con-list padding15">
<div class="fl task-form-90 ">
<a href="<%= shixun_path(shixun) %>" class="edu-class-inner-list fl" style="color: #333" target="_blank" ><%= shixun.name %></a>
<a href="<%= shixun_path(shixun) %>" class="edu-class-inner-list fl" style="color: #333"><%= shixun.name %></a>
<div class="cl"></div>
<p class="color-grey font-12">
<span class="w100 fl"><%= shixun.language %></span>

View File

@ -97,6 +97,7 @@
</p>
</div>
<div class="top-right fr font-14 mr10">
<% update_visiti_count @user %>
<% if current_user %>
<div class="mynew">
<!--<p class="mt5">-->
@ -105,7 +106,6 @@
<p class="p2 font-12 mt5">
<i class="fa fa-eye font-12" aria-hidden="true"></i>
<% update_visiti_count @user %>
<span><%= @user.visits.to_i %></span> 次访问
</p>
<p class="p3 fr font-14 mt20">

View File

@ -140,6 +140,7 @@ RedmineApp::Application.routes.draw do
match 'game_build', :via => [:get, :post]
match 'get_waiting_time', :via => [:get, :post]
match 'next_step', :via => [:get, :post]
match 'prev_step', :via => [:get, :post]
match 'reset_original_code', :via => [:get, :post]
match 'reset_new_code', :via => [:get, :post]
get 'entry'

View File

@ -0,0 +1,5 @@
class AddCompileSuccessToOutputs < ActiveRecord::Migration
def change
add_column :outputs, :compile_success, :integer, :default => 1
end
end

View File

@ -0,0 +1,13 @@
class ModifyCompileSuccessToOutputs < ActiveRecord::Migration
def up
error_output = Output.find_by_sql("SELECT * FROM `outputs` where actual_output like '%error%'")
unless error_output.blank?
error_output.each do |e|
e.update_column(:compile_success, 0)
end
end
end
def down
end
end

View File

@ -0,0 +1,5 @@
class AddAnswerOpenEvaluationToHomeworkDetailManuals < ActiveRecord::Migration
def change
add_column :homework_detail_manuals, :answer_open_evaluation, :boolean, :default => false
end
end

View File

@ -2,6 +2,22 @@
namespace :homework_publishtime do
desc "start publish homework and end homework"
def had_passed_changllenge_num_rake myshixun
if myshixun.nil?
0
else
myshixun.games.select{|game| game.status == 2}.count
end
end
def had_passed_no_ans_changllenge_num_rake myshixun
if myshixun.nil?
0
else
myshixun.games.select{|game| game.status == 2 && game.answer_open == 0}.count
end
end
task :publish => :environment do
Rails.logger.info("log--------------------------------homework_publish start")
homework_commons = HomeworkCommon.includes(:homework_detail_manual).where("publish_time <= '#{Time.now}' and homework_detail_manuals.comment_status = 0")
@ -43,13 +59,20 @@ namespace :homework_publishtime do
end
task :end => :environment do
# Rails.logger.info("log--------------------------------homework_publish_end start")
# homework_commons = HomeworkCommon.includes(:homework_detail_manual).where("end_time <= '#{Time.now}' and allow_late = 1 and homework_detail_manuals.comment_status = 1")
# homework_commons.each do |homework|
# homework_detail_manual = homework.homework_detail_manual
# homework_detail_manual.update_column('comment_status', 2)
# end
# Rails.logger.info("log--------------------------------homework_publish_end end")
Rails.logger.info("log--------------------------------homework_publish_end start")
homework_commons = HomeworkCommon.includes(:homework_detail_manual).where("homework_type = 4 and end_time <= '#{Time.now}' and homework_detail_manuals.comment_status = 1")
homework_commons.each do |homework|
homework.homework_detail_manual.update_column("comment_status", 2)
shixun = homework.homework_commons_shixuns.shixun
homework.student_works.where("work_status != 0").each do |student_work|
passed_count = homework.homework_detail_manual.answer_open_evaluation ? had_passed_changllenge_num_rake(student_work.myshixun) : had_passed_no_ans_changllenge_num_rake(student_work.myshixun)
final_score =(passed_count.to_f / shixun.challenges.count) * 100
student_work.update_column("final_score", format("%.2f",final_score.to_f))
score = final_score - student_work.late_penalty
student_work.update_column("work_score", format("%.2f",(score < 0 ? 0 : score).to_f))
end
end
Rails.logger.info("log--------------------------------homework_publish_end end")
end
task :archive => :environment do
@ -58,6 +81,17 @@ namespace :homework_publishtime do
homework_commons.each do |homework|
homework_detail_manual = homework.homework_detail_manual
homework_detail_manual.update_column('comment_status', 6)
if homework.homework_type == 4
shixun = homework.homework_commons_shixuns.shixun
homework.student_works.where("work_status != 0").each do |student_work|
passed_count = homework.homework_detail_manual.answer_open_evaluation ? had_passed_changllenge_num_rake(student_work.myshixun) : had_passed_no_ans_changllenge_num_rake(student_work.myshixun)
final_score =(passed_count.to_f / shixun.challenges.count) * 100
student_work.final_score = format("%.2f",final_score.to_f)
score = student_work.final_score - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
student_work.save
end
end
end
Rails.logger.info("log--------------------------------homework_archive end")
end

View File

@ -1220,7 +1220,7 @@ function search_course_ajax(str){
if($(".course_list_ul").find("li").length>5){
$(".course_list_ul").css("overflow-y","scroll");
} else{
$(".course_list_ul").css("overflow-y","auto");
$(".course_list_ul").css("overflow-y","hidden");
}
} else{
$(".course_list_ul").hide();

View File

@ -180,7 +180,27 @@ $(function(){
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
validateOnBlur:false,
onSelectDate:function() {
if($.trim($("input[name='homework_end_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='homework_publish_time']").val().replace(/-/g, "/")));
$("input[name='homework_end_time']").val(formate_time(new Date(date.setDate(date.getDate()+14))));
}
if($.trim($("input[name='homework_archive_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/")));
$("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
}
},
onSelectTime:function() {
if($.trim($("input[name='homework_end_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='homework_publish_time']").val().replace(/-/g, "/")));
$("input[name='homework_end_time']").val(formate_time(new Date(date.setDate(date.getDate()+14))));
}
if($.trim($("input[name='homework_archive_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/")));
$("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
}
}
});
$("input[name='homework_end_time']").datetimepicker({

View File

@ -133,58 +133,32 @@ $(function() {
}
});
// var changeColor = function(c){
// if(c.find(".blue").css("display") == "none") {
// c.find(".blue").show();
// c.find(".grey").hide();
// c.find("input").attr("checked", "checked");
//
// } else {
// c.find(".blue").hide();
// c.find(".grey").show();
// c.find("input").removeAttr("checked");
//
// }
// };
// $(".open-select").click(function() {
// changeColor($(this));
// if($("#allselect").find("input").is(':checked')) {
// //console.log(1);
// $(".member .student .newstudent .open-select").find("input").attr("checked", "checked");
// $(".member .student .newstudent .open-select").find(".blue").show();
// $(".member .student .newstudent .open-select").find(".grey").hide();
// }
// var $length = $(".member .student .newstudent .open-select input").length;
// var flag = true;
// for(i = 0; i < $length; i++) {
// var $b = $(".member .student .newstudent .open-select input").eq(i);
// if(! $b.is(':checked')) {
// //console.log(1)
// flag = false;
// break;
// }
// if(flag) {
// $("#allselect").find("input").attr("checked", "checked");
// $("#allselect").find(".blue").show();
// $("#allselect").find(".grey").hide();
// }
// }
// });
// var RadioButton = function(b,c){
// $(b).find(".grey").show();
// $(b).find(".blue").hide();
// $(b).find("input").removeAttr("checked");
// changeColor(c);
// };
// $(".single-choice1").click(function(){
//
// RadioButton(".single-choice1",$(this));
// });
// $(".single-choice2").click(function(){
//
// RadioButton(".single-choice2",$(this));
// });
// 课堂设置
$("#edit_course_list").on('input', function(e){
throttle(search_course_list, window, e);
});
$("#edit_course_list").on('click', function (e) {
if ($("#edit_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。
event.stopPropagation();
return;
} else{
event.stopPropagation();
search_course_ajax('');
}
});
$("#edit_course_list").on('blur', function(e){
if($("#edit_course_name").val() == ""){
$("#edit_course_name").val($("#edit_course_list").val());
} else{
if($("#edit_course_name").val().indexOf(course_list_name) == 0){
$("#edit_course_name").val($("#edit_course_name").val().replace(course_list_name, $("#edit_course_list").val()));
} else{
$("#edit_course_name").val($("#edit_course_list").val() + $("#edit_course_name").val());
}
}
course_list_name = $("#edit_course_list").val();
regex_course_name('edit');
});
});
function add_new_group(id){

View File

@ -110,6 +110,14 @@ $(function(){
});
// end
// 上一关增加loading效果
$("#prev_step").live("click", function(){
nNext = $("#prev_step_area");
html = "<a href='javascript:void(0);' class='task-btn mr15 mt8'>上一关<img src='/images/bigdata/loading2.svg' style='width:25px;float:left;margin-top: 3px' /></a>";
nNext.html(html);
});
// end
});
// 查看参考答案
@ -327,6 +335,7 @@ function setupAjaxIndicatorBase() {
|| settings.url.match(/game_status/)
|| settings.url.match(/refresh_game_list/)
|| settings.url.match(/next_step/)
|| settings.url.match(/prev_step/)
|| settings.url.match(/open_webssh/)
|| settings.url.match(/repository/)
)){
@ -368,7 +377,6 @@ function code_evaluation(test_sets,
/**
* Created by wang on 2017/8/9.
*/
var $EffectDisplay , $b, $TestResult, $d, $e, $f, $g, $h, $EvaluationInformation , $n;
// 第一块 效果显示
$EffectDisplay = "<div id=\"blacktab_con_1\" class=\"\" ></div>";
@ -380,6 +388,7 @@ function code_evaluation(test_sets,
"</form>" +
"<iframe frameborder=\"0\" name=\"myFrame\" style='background: #fff;height: 100%;'>" +
"</iframe>" +
"<div class='-brother undis'></div>" +
"</div>" +
"</div>";
@ -428,13 +437,13 @@ function code_evaluation(test_sets,
"<li class=\"clearfix\">" +
"<div class=\"clearfix\">" +
" <span class=\"-task-ces-info-left color-blue fl fb\">预期输出:</span>" +
"<p class=\"fl\">" + ( test_sets[i].output == null ? "空" : test_sets[i].output.replace(/\r\n/g, "<br>").replace(/ /g, "<span class=\"empty\"></span>") ) + "</p>" +
"<p class=\"fl\">" + ( test_sets[i].output == null ? "空" : test_sets[i].output.replace(/\r\n/g, "<br>").replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;").replace(/ /g, "<span class=\"empty\"></span>") ) + "</p>" +
"</div>" +
"</li>" +
"<li class=\"clearfix\">" +
"<div class=\"clearfix\">" +
"<span class=\"-task-ces-info-left color-blue fl fb\">实际输出:</span>" +
"<p class=\"fl color-orange\">" + (test_sets[i].actual_output == null ? "空" : test_sets[i].actual_output.replace(/\r\n/g, "<br>").replace(/ /g, "<span class=\"empty\"></span>")) + "</p>" +
"<p class=\"fl color-orange\">" + (test_sets[i].actual_output == null ? "空" : (test_sets[i].compile_success == "1" ? test_sets[i].actual_output.replace(/\r\n/g, "<br>").replace(/ /g, "<span class=\"empty\"></span>") : test_sets[i].actual_output.replace(/\r\n/g, "<br>"))) + "</p>" +
"</div>" +
"</li>" +
"</ul>" +

View File

@ -120,7 +120,6 @@ a:hover.edu-class-right-add{ background-color: rgba(0, 0, 0, 0.4);}
.edu-reference-ma-block{height: 40px; margin: 30px auto; text-align: center; font-size: 16px; color: #9a9a9a;}
.stud-class-container{width:1200px;margin:10px auto 20px;}
.stud-class-container p{height:42px;line-height:42px;}
.stud-class-container .con-top{height:42px;line-height:42px;background:#fff;}
.stud-class-container .con-content{background:#fff;}
.stud-class-container .con-content ul{width:45%;}

View File

@ -95,7 +95,7 @@ a:hover.panel-list-title{color:#29bd8b;}
a.panel-name-small{ display: inline-block; max-width:100px; color:#29bd8b; font-size:12px; }
.panel-list-infobox{ width: 92%; margin-left:8%; margin-top:-70px;}
.panel-lightgrey,.panel-lightgrey span{ font-size:12px; color:#888;}
.panel-inner-info{ width: 92%; margin-left:8%; color:#666;}
.panel-inner-info{ width: 92%; margin-left:8%;}
.panel-bg-grey{ padding:5px 0;background:#f6f6f6; width: 100%; color:#666;}
.panel-list-nodata{ width: 420px; margin:100px auto; text-align: center;}
@ -380,5 +380,4 @@ input::-ms-input-placeholder,textarea::-ms-input-placeholder {color:#cccccc;}
/*-----课程名称下拉框--------*/
.course_list_ul{display: none;position: absolute;top:40px;left: -1px;width: 100% !important;border:1px solid #eeeeee;background: #FFFFFF;padding-bottom: 5px; max-height: 150px;z-index: 10}
.course_list_ul li{height:20px;padding:5px 10px;clear:both;line-height:28px;margin-bottom: 0 !important;cursor: pointer;}
.course_list_ul li{height:20px;padding:5px 10px;clear:both;line-height:28px;margin-bottom: 0 !important;cursor: pointer;}

View File

@ -343,7 +343,7 @@ a.shixun-task-ban-btn{background-color: #c2c4c6;display: inline-block;font-weigh
.scroll_lesson{overflow-x: hidden;overflow-y: scroll;}
.searchFor{width:auto;}
.searchFor .searchCon{width:240px;border-bottom:1px solid #cccccc;float: left;height: 30px;display: none;}
.searchFor .searchCon{width:240px;border-bottom:1px solid #cccccc;float: left;height: 30px;}
.searchFor .searchCon input{border: none;outline: none;height: 29px;width:91%;}
.searchFor .searchImg{margin:5px 10px 0px 0px;cursor: pointer;}