dev_trainings
guange 6 years ago
commit a2ca817642

@ -132,6 +132,15 @@ class ApplicationController < ActionController::Base
end
end
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
# 随机生成字符
def generates_identifier(container, num)
code = DCODES.sample(num).join
while container.exists?(identifier: code) do
code = DCODES.sample(num).join
end
code
end
def ec_public_auth major_school
unless User.current.admin? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 ||

@ -31,9 +31,9 @@ class CollegesController < ApplicationController
end
def verification_school_identifier
school = School.where(:identifier => params[:identifier]).first
status = school.present? ? 1 : 0
render :json => {status: status}
schools = School.where(identifier: params[:identifier])
schools = schools.where('id != ?', params[:school_id]) if params[:school_id].present?
render :json => { status: schools.exists? ? 1 : 0 }
end
def online_school

@ -2394,9 +2394,10 @@ class CoursesController < ApplicationController
sheet1[4,0] = "排名"
sheet1[4,1] = "学生姓名"
sheet1[4,2] = "昵称"
sheet1[4,3] = "学号"
sheet1[4,4] = "分班"
current_col = 4
sheet1[4,3] = "邮箱"
sheet1[4,4] = "学号"
sheet1[4,5] = "分班"
current_col = 5
homeworks.where(:homework_type => 4).each do |homework|
sheet1[4,current_col+=1] = "#{homework.name}"
end
@ -2428,6 +2429,7 @@ class CoursesController < ApplicationController
sheet1[count_row,column]= i+1
sheet1[count_row,column+=1] = member.user.show_real_name
sheet1[count_row,column+=1] = member.user.login
sheet1[count_row,column+=1] = member.user.mail
sheet1[count_row,column+=1] = member.user.user_extensions.student_id
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
# current_col = 5

@ -30,9 +30,9 @@ class HomeworkCommonController < ApplicationController
@homework_type = params[:homework_type].to_i
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
if @search
@homework_commons = @course.homework_commons.where(:homework_type => @homework_type).where("homework_commons.name like '%#{@search}%'").includes(:homework_detail_manual, :homework_group_settings, :student_works)
@homework_commons = @course.homework_commons.where(:homework_type => @homework_type).where("homework_commons.name like '%#{@search}%'")
else
@homework_commons = @course.homework_commons.where(:homework_type => @homework_type).includes(:homework_detail_manual, :homework_group_settings, :student_works)
@homework_commons = @course.homework_commons.where(:homework_type => @homework_type)
end
if @is_teacher
@homework_commons = @homework_commons
@ -72,6 +72,9 @@ class HomeworkCommonController < ApplicationController
@is_new = params[:is_new]
@homeworks = paginateHelper @homework_commons,15
@homeworks = @homework_type == 4 ? @homeworks.includes(:homework_detail_manual, :homework_group_settings, [homework_commons_shixuns: :shixun]) :
@homeworks.includes(:homework_detail_manual, :homework_group_settings)
#设置at已读
=begin
ids = @homeworks.inject([]) do |ids, homework|

@ -4,8 +4,8 @@ class Managements::SchoolsController < Managements::BaseController
def statistics
@sub_type = 1
params[:sort_by] = :teacher_count if params[:sort_by].blank?
params[:sort_direction] = :desc if params[:sort_direction].blank?
params[:sort_by] = params[:sort_by].presence || :teacher_count
params[:sort_direction] = params[:sort_direction].presence || :desc
service = Management::SchoolReportService.new(params)
@obj_count, @schools = service.call
@ -20,8 +20,8 @@ class Managements::SchoolsController < Managements::BaseController
def data_grow
@sub_type = 2
params[:data_type] ||= 'grow'
params[:sort_by] = :teacher_increase_count if params[:sort_by].blank?
params[:sort_direction] = :desc if params[:sort_direction].blank?
params[:sort_by] = params[:sort_by].presence || :teacher_increase_count
params[:sort_direction] = params[:sort_direction].presence || :desc
service = Management::SchoolDataGrowService.new(params)
@grow_summary = service.grow_summary
@ -31,7 +31,7 @@ class Managements::SchoolsController < Managements::BaseController
end
def data_contrast
params[:contrast_column] = :teacher_increase_count if params[:contrast_column].blank?
params[:contrast_column] = params[:contrast_column].presence || :teacher_increase_count
params[:sort_direction] ||= :desc
params[:sort_by] = :percentage

@ -851,6 +851,15 @@ class ManagementsController < ApplicationController
@front_js = eva.front_js
end
def evaluate_simple
page = params[:page]
@recodes = EvaluateRecord.where("created_at > ?", Time.now - 1.days).reorder("consume_time desc")
@recodes_count = @recodes.size
@record_pages = Paginator.new @recodes_count, 20, page || 1
@offset ||= @record_pages.offset
@recodes = paginateHelper @recodes, 20
end
# 评测时间列表
def evaluate_records
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
@ -866,7 +875,7 @@ class ManagementsController < ApplicationController
keyword = params[:keyword]
limit = 20
if search
if search.present?
if "u_name" == keyword
@evaluate_recods = EvaluateRecord.joins("join users u on evaluate_records.user_id = u.id").where("concat(u.lastname, u.firstname) like '%#{search}%'")
# @evaluate_recods = EvaluateRecord.where(user_id: User.where("concat(lastname, firstname) like '%#{search}%'").pluck(:id))
@ -875,7 +884,12 @@ class ManagementsController < ApplicationController
# @evaluate_recods = EvaluateRecord.where(user_id: UserExtensions.where(school_id: School.where("name like '%#{search}%'").pluck(:id)).pluck(:user_id))
end
else
@evaluate_recods = EvaluateRecord.where("0=0")
@evaluate_recods = EvaluateRecord.where(nil)
end
if params[:beginTime].present?
endTime = params[:endTime].present? ? params[:endTime] : Time.now
@evaluate_recods = @evaluate_recods.where("created_at >= ? and created_at <= ?", params[:beginTime], endTime)
end
@evaluate_recods_count = @evaluate_recods.count
@ -1504,7 +1518,7 @@ end
if search.blank?
@schools = School.where("0=0")
else
@schools = School.where("name like '%#{search}%'")
@schools = School.where("name like ?", "%#{search}%")
end
if params[:index] == '8'
@schools = @schools.reorder("created_at #{@sx_order}")
@ -4194,7 +4208,7 @@ end
sheet1 = book.create_worksheet :name => "course"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
sheet1.row(0).concat(["ID","课堂名称","成员","资源","普通作业"," 实训作业","试卷","私有","状态","创建者单位","创建者","动态时间","创建时间"])
sheet1.row(0).concat(["ID","课堂名称","成员","资源","普通作业"," 实训作业","试卷","评测次数", "私有","状态","创建者单位","创建者","动态时间","创建时间"])
count_row = 1
courses.each do |course|
school = course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.school_name
@ -4206,12 +4220,13 @@ end
sheet1[count_row,4] = course.homework_commons.where(:homework_type => 1).count
sheet1[count_row,5] = course.homework_commons.where(:homework_type => 4).count
sheet1[count_row,6] = course.exercises.count
sheet1[count_row,7] = course.is_public.to_i == 1 ? '否' : '是'
sheet1[count_row,8] = course.is_end ? "已结束" : "正在进行"
sheet1[count_row,9] = school
sheet1[count_row,10] = teacher_name
sheet1[count_row,11] = format_time(course.updatetime)
sheet1[count_row,12] = format_time(course.created_at)
sheet1[count_row,7] = course.evaluate_count
sheet1[count_row,8] = course.is_public.to_i == 1 ? '否' : '是'
sheet1[count_row,9] = course.is_end ? "已结束" : "正在进行"
sheet1[count_row,10] = school
sheet1[count_row,11] = teacher_name
sheet1[count_row,12] = format_time(course.updatetime)
sheet1[count_row,13] = format_time(course.created_at)
count_row += 1
end
book.write xls_report

@ -467,7 +467,7 @@ class MyshixunsController < ApplicationController
# taskId 即返回的game id
# 返回结果params [:stauts] 0 表示运行结果成功,其它则失败
# compile_success 1 表示成功; 0表示失败
# compile_success 1 表示成功; 0表示编译失败; -1 表示创建pod失败 -2 表示克隆代码失败
# msg 错误信息
# output 为测试用户编译输出结果
# myshixun:status 1为完成实训
@ -475,7 +475,7 @@ class MyshixunsController < ApplicationController
# resubmit 1表示已通关后重新评测0表示非重新评测
# retry_status 0初始值1重新评测失败2重新评测成功
# tpiRepoPath 中间层图片的workspace路径
# params[:jsonTestDetails] = '{"buildID":"19284","compileSuccess":"1",
# params[:jsonTestDetails] = '{"buildID":"19284","compileSuccess":"1","createPodStatus": "1", "downloadStatus": "1",
# "msg":[{"caseId":"1","expectedOutput":"MSAyIDMNCg","input":"MiAzIDE","output":"MSAyIDMNCg","passed":"1"},
# {"caseId":"2","expectedOutput":"LTMgMSA2DQo","input":"LTMgNiAx","output":"LTMgMSA2DQo","passed":"1"},
# {"caseId":"3","expectedOutput":"LTcgLTUgLTMNCg","input":"LTcgLTMgLTU","output":"LTcgLTUgLTMNCg","passed":"1"}],
@ -497,7 +497,19 @@ class MyshixunsController < ApplicationController
resubmit = jsonTestDetails['resubmit']
outPut = tran_base64_decode64(jsonTestDetails['outPut'])
jenkins_testsets = jsonTestDetails['msg']
compile_success = jsonTestDetails['compileSuccess']
compile_success = jsonTestDetails['compileSuccess']
# # 创建pod的状态 0 失败 1 成功
# create_pod_status = jsonTestDetails['createPodStatus']
# # 克隆代码的装填 0 失败 1 成功
# clone_code_status = jsonTestDetails['downloadStatus']
# # 1表示编译成功0 表示运行异常; -1 表示克隆代码失败; -2 表示创建pod失败
# compile_success = if clone_code_status == "0"
# -1
# elsif create_pod_status == "0"
# -2
# else
# jsonTestDetails['compileSuccess']
# end
# message = Base64.decode64(params[:msg]) unless params[:msg].blank?
logger.info(outPut)
game = Game.find(game_id)
@ -523,7 +535,7 @@ class MyshixunsController < ApplicationController
end
logger.info("#############status: #{status}")
logger.info("#############resubmit: #{resubmit}")
record = EvaluateRecord.where(:game_id => game_id).first
record = EvaluateRecord.where(:identifier => params[:sec_key]).first
logger.info("training_task_status start#3**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
# status0表示评测成功

@ -586,9 +586,9 @@ class StudentWorkController < ApplicationController
if @stundet_works.size != 0
if @order == "student_id"
@stundet_works = @stundet_works.includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("user_extensions.student_id #{@b_sort}")
@stundet_works = @stundet_works.includes(:user => {:user_extensions => []}).order("user_extensions.student_id #{@b_sort}")
else
@stundet_works = @stundet_works.includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}")
@stundet_works = @stundet_works.order("#{@order} #{@b_sort}")
end
end
@ -615,6 +615,16 @@ class StudentWorkController < ApplicationController
_index
@stundet_works = paginateHelper @stundet_works, @limit
if @stundet_works.size != 0
@stundet_works = if @homework.homework_type == 1
@stundet_works.includes(:student_works_scores, [user: :user_extensions])
elsif @homework.homework_type == 3
@stundet_works.includes(:student_works_scores, [project: :project_score], [user: :user_extensions])
elsif @homework.homework_type == 4
@stundet_works.includes(:student_works_scores, [myshixun: :games], [user: :user_extensions])
end
@members = @course.members.where(user_id: @stundet_works.pluck(:user_id)).select([:user_id, :course_group_id])
end
respond_to do |format|
format.js
format.html { render :layout => 'base_edu'}

@ -191,7 +191,7 @@ module ApplicationHelper
# 分班
def member_group_name members, user_id
member = members.where(:user_id => user_id).first
member = members.find_by_user_id(user_id)
group_name = member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name
end
@ -269,12 +269,12 @@ module ApplicationHelper
end
# 实训作品列表的提交状态
def list_work_status work, homework, member
def list_work_status work, homework, course_group_id
if work.work_status == 0
str = "未提交"
else
if work.compelete_status == 0
setting_time = homework_group_setting homework, member.try(:course_group_id)
setting_time = homework_group_setting homework, course_group_id
end_time = setting_time.end_time.present? ? setting_time.end_time : homework.end_time
if end_time > Time.now || (homework.allow_late && !homework.course.is_end)
str = "正在提交"
@ -1317,11 +1317,11 @@ module ApplicationHelper
def had_commit_studentwork_count homework_common
member = homework_common.course.members.where(:user_id => User.current.id).first
student_works = homework_common.student_works
if member.present? && member.teacher_course_groups.count > 0
if member.present? && member.teacher_course_groups.size > 0
group_students = homework_common.course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id)
student_works = student_works.where(:user_id => group_students)
end
student_works.where("work_status !=?", 0).count
student_works.where("work_status !=?", 0).size
end
# 实训作业的有效作品数
@ -1357,11 +1357,11 @@ module ApplicationHelper
def had_uncommit_studentwork_count homework_common
member = homework_common.course.members.where(:user_id => User.current.id).first
student_works = homework_common.student_works
if member.present? && member.teacher_course_groups.count > 0
if member.present? && member.teacher_course_groups.size > 0
group_students = homework_common.course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id)
student_works = student_works.where(:user_id => group_students)
end
student_works.where("work_status =?", 0).count
student_works.where("work_status =?", 0).size
end
# 未评阅
@ -1369,12 +1369,12 @@ module ApplicationHelper
#count = StudentWorksScore.find_by_sql("SELECT count(distinct student_work_id) as count FROM student_works_scores sws, student_works sw, homework_commons hc where hc.id =#{homework_common.id} and sw.homework_common_id=hc.id and sw.is_delete = 0 and sws.student_work_id = sw.id and sws.user_id=#{User.current.id};").first.try(:count).to_i
member = homework_common.course.members.where(:user_id => User.current.id).first
student_works = homework_common.student_works
if member.present? && member.teacher_course_groups.count > 0
if member.present? && member.teacher_course_groups.size > 0
group_students = homework_common.course.members.where(:course_group_id => member.teacher_course_groups.pluck(:course_group_id)).map(&:user_id)
student_works = student_works.where(:user_id => group_students)
end
has_comment = StudentWorksScore.where(:student_work_id => student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count
student_count = student_works.count
has_comment = StudentWorksScore.where(:student_work_id => student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).size
student_count = student_works.size
return student_count - has_comment
end
@ -6568,7 +6568,7 @@ def update_shixun_work_status homework
else
setting = homework.homework_group_settings.where("publish_time < '#{Time.now}'")
if setting.blank?
student_works = student_works.where("0=1")
student_works = student_works.none
else
users = homework.course.members.where(:course_group_id => setting.map(&:course_group_id))
student_works = student_works.where(:user_id => users.map(&:user_id))
@ -6578,7 +6578,7 @@ def update_shixun_work_status homework
myshixuns = Myshixun.where(:shixun_id => shixun.id, :user_id => student_works.map(&:user_id))
myshixuns.each do |myshixun|
work = student_works.where(:user_id => myshixun.user_id).first
member = Member.find_by_sql("select course_group_id from members where course_id = #{homework.course_id} and user_id = #{work.user_id}").first
member = homework.course.members.find_by(:user_id => work.user_id)
setting_time = homework_group_setting homework, member.try(:course_group_id)
games = myshixun.games.where(:challenge_id => challeng_ids)
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
@ -7220,8 +7220,8 @@ def search_work_member works,name
select_works = works
else
name = name.downcase
select_works = works.select{ |work| work.user.user_extensions[:student_id].to_s.downcase.include?(name) || (work.user[:lastname].to_s.downcase + work.user[:firstname].to_s.downcase).include?(name)
}
select_works = works.joins(user: :user_extensions).where("concat(lastname, firstname) like ?
or student_id like ?", "%#{name}%", "%#{name}%")
end
select_works
end

@ -500,6 +500,15 @@ class Course < ActiveRecord::Base
end
end
# 课堂实训作业的评测次数
def evaluate_count
course_user_ids = self.members.map(&:user_id)
shixun_ids = self.homework_commons.joins(:homework_commons_shixuns).where(homework_type: 4).pluck(:shixun_id)
return 0 if shixun_ids.blank?
Game.joins(:challenge).where(challenges: {shixun_id: shixun_ids}, games: {user_id: course_user_ids}).sum(:evaluate_count)
end
#课程动态公共表记录
def act_as_course_activity
self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id)

@ -150,7 +150,7 @@ class HomeworkCommon < ActiveRecord::Base
# 作业的实训
def shixun
Shixun.find(self.homework_commons_shixuns.try(:shixun_id))
homework_commons_shixuns.shixun
end
# 作业实训过关的数目

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

@ -347,10 +347,12 @@ class GamesService
rev = params[:rev] ? params[:rev] : "master"
content_modified = 0
ActiveRecord::Base.transaction do
sec_key = generates_identifier(EvaluateRecord, 10)
# params[:evaluate] 实训评测时更新必须给的参数,需要依据该参数做性能统计,其它类型的更新可以跳过
# 自动保存的时候evaluate为0点评测的时候为1
if params[:evaluate] == 1
record = EvaluateRecord.create!(:user_id => current_user.id, :shixun_id => @myshixun.shixun.id, :game_id => @game.id)
record = EvaluateRecord.create!(:user_id => current_user.id, :shixun_id => @myshixun.shixun.id,
:game_id => @game.id, :identifier => sec_key)
Rails.logger.warn("##game is is #{@game.id}, record id is #{record.id}, time is**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
# @myshixun.student_works.update_all(:update_time => Time.now) if !@myshixun.student_works.blank?
student_work_time = format("%.3f", (Time.now.to_f - record.created_at.to_f)).to_f
@ -385,7 +387,7 @@ class GamesService
if content != last_content && code_file.blank?
raise("update file failed")
else
return {:success => "success", :resubmit => resubmit ,:content_modified => content_modified}
return {:success => "success", :resubmit => resubmit ,:content_modified => content_modified, sec_key: record.identifier}
end
end
rescue Exception => e
@ -546,7 +548,7 @@ class GamesService
:testCases => "#{testCases}", :resubmit => "#{resubmit}", :times => params[:first].to_i, :podType => shixun.webssh,
:containers => "#{Base64.urlsafe_encode64(container_limit(shixun.mirror_repositories))}", :tpmScript => "#{tpmScript}",
:timeLimit => "#{shixun.exec_time}", :content_modified => content_modified, :persistenceName => shixun.identifier,
:isPublished => (shixun.status < 2 ? 0 : 1)}
:isPublished => (shixun.status < 2 ? 0 : 1), :sec_key => params[:sec_key]}
# 评测有文件输出的需要特殊传字段 path表示文件存储的位置
params['file'] = Base64.urlsafe_encode64({:path => "#{game_challenge.picture_path}"}.to_json) if game_challenge.picture_path.present?
@ -569,7 +571,8 @@ class GamesService
# ----单测模式end
return {:result => "success", :resubmit => resubmit, :ableToCreate => res['ableToCreate'], :waitNum => res['waitNum'],
:waitingTime => res['waitingTime'], :position => game_challenge.position, :port => res['port'], :had_done => game.had_done }
:waitingTime => res['waitingTime'], :position => game_challenge.position, :port => res['port'],
:had_done => game.had_done}
rescue Exception => e
Rails.logger.error("评测出错,详情:" + e.message)
return {:result => 'fail', :contents =>"实训云平台繁忙繁忙等级502请稍后刷新并重试", :position => game_challenge.position, :had_done => game.had_done}
@ -878,7 +881,7 @@ class GamesService
mirror_name = shixun.mirror_name
# 轮询结束,更新评测耗时
e_record = EvaluateRecord.where(:game_id => game.id).first
e_record = EvaluateRecord.where(:identifier => params[:sec_key]).first
if game_status == 0 || game_status == 2
if e_record
front_js = format("%.3f", (Time.now.to_f - e_record.try(:updated_at).to_f)).to_f

@ -49,8 +49,9 @@
<%= javascript_include_tag 'attachments' %>
<style>
.ui-widget-content{
height: 16px;
width: 200px;
/*height: 16px;*/
/*width: 200px;*/
top: 320px !important;
float: left;
margin: 5px 10px 0px 10px;
}

@ -86,7 +86,7 @@
<% if @current_myshixun %>
<% current_game = challenge.games.where(:user_id => User.current).first %>
<% case current_game.try(:status) %>
<% when 0, 1 %>
<% when 0, 1 %>
<% if @current_modify %>
<a href='javascript:void(0)' class="edu-default-btn edu-blueback-btn fr" onclick="begin_sXun('<%= @current_myshixun.try(:id) %>')">直接挑战</a>
<% else %>
@ -96,7 +96,7 @@
<a href="<%= operation_shixun_path(@shixun, :myshixun_id => @current_myshixun.try(:id)) %>" data-remote="true" class="edu-default-btn edu-blueline-btn fr">已完成</a>
<% when 3, nil %>
<% if @shixun.task_pass %>
<a href='javascript:void(0)' class="edu-default-btn edu-blueback-btn fr" onclick="begin_sXun('<%= @current_myshixun.try(:id) %>')">直接挑战</a>
<a href='<%= myshixun_game_path(current_game, :myshixun_id => @current_myshixun.try(:id)) %>' class="edu-default-btn edu-blueback-btn fr" >直接挑战</a>
<% else %>
<a href="javascript:void(0)" data-tip-down="请先完成前序关卡" class="edu-default-btn edu-greyback-btn fr">直接挑战</a>
<% end %>

@ -61,22 +61,22 @@
<% end %>
<% end %>
<%# elsif homework_common.homework_type != 4 %>
<% else %>
<% if had_commit_studentwork_count(homework_common) > 0 %>
<span class="ml50 fl">
<%= link_to had_commit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id), :class => 'color-orange03 mr5', :target => '_blank' %>
已交
</span>
<%# else %>
<%# if had_commit_studentwork_count(homework_common) > 0 %>
<!-- <span class="ml50 fl">-->
<%#= link_to had_commit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id), :class => 'color-orange03 mr5', :target => '_blank' %>
<!-- 已交-->
<!-- </span>-->
<%# if homework_common.homework_type == 4 %>
<!--<span class="ml50">-->
<!--<a href="javascript:void(0);" class="color-orange03 mr5" style="cursor: default"><%#= homework_common.pass_game_count %></a>通关-->
<!--</span>-->
<%# end %>
<span class="ml50 fl">
<%= link_to had_uncommit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id), :class => 'color-orange03 mr5', :target => '_blank' %>
未交
</span>
<% end %>
<!-- <span class="ml50 fl">-->
<%#= link_to had_uncommit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id), :class => 'color-orange03 mr5', :target => '_blank' %>
<!-- 未交-->
<!-- </span>-->
<%# end %>
<%# elsif homework_common.homework_type == 4 && homework_common.homework_commons_shixuns.shixun %>
<%# had_passed_count = had_passed_changllenge_count(homework_common.homework_commons_shixuns.shixun, User.current) %>
<%# challenge_count = homework_common.homework_commons_shixuns.shixun.challenges.count %>
@ -129,7 +129,7 @@
<%= link_to "创建项目", new_project_path(:host=>Setting.host_name, :course_id => homework_common.course_id), :class => 'white-btn orange-btn fr mr10 mt8', :target => "_blank" %>
<% end %>
<% elsif homework_common.homework_type == 4 && homework_common.homework_commons_shixuns.shixun %>
<%= link_to "实训详情", shixun_path(Shixun.find(homework_common.homework_commons_shixuns.shixun_id)), :target => "_blank", :class => 'white-btn orange-btn fr mr10 mt8' %>
<%= link_to "实训详情", shixun_path(homework_common.homework_commons_shixuns.shixun.try(:identifier)), :target => "_blank", :class => 'white-btn orange-btn fr mr10 mt8' %>
<% end %>
<% if @is_teacher %>
@ -148,7 +148,7 @@
<li>
<%= link_to '立即发布', publish_notice_homework_common_path(homework_common), :remote => true %>
</li>
<% elsif (homework_common.homework_detail_manual.try(:comment_status) == 1 || homework_common.homework_detail_manual.try(:comment_status) == 2) && homework_common.end_time > Time.now %>
<% elsif (homework_common.homework_detail_manual.try(:comment_status) == 1 || homework_common.homework_detail_manual.try(:comment_status) == 2) && homework_common.end_time && homework_common.end_time > Time.now %>
<li>
<%= link_to '立即截止', end_notice_homework_common_path(homework_common), :remote => true %>
</li>

@ -13,9 +13,9 @@
</li>
<% unless course_board.children.empty? %>
<ul>
<% course_board.children.reorder("position asc").each do |board| %>
<% course_board.children.includes(:messages).reorder("position asc").each do |board| %>
<li id="board_children_<%= board.id %>" class="clearfix">
<% count = board ? board.messages.count : 0 %>
<% count = board ? board.messages.size : 0 %>
<a href="<%= course_boards_path(@course, :board_id => board.id) %>" class="fl"><span class="fl ml38 devide_class task-hide" data-tip-down="<%=board.name %>"><%=board.name %></span>
<% if count > 0 %>
<span class="fr mr30 courseNewNum"><%= count %></span>

@ -17,9 +17,9 @@
</a>
</li>
<% end %>
<% @course.course_groups.each do |group| %>
<% @course.course_groups.includes(:members).each do |group| %>
<li id="course_group_<%=group.id %>" class="clearfix">
<% count = group.members.count %>
<% count = group.members.size %>
<a href="<%= students_course_path(@course, :group_id => group.id) %>" class="fl"><span class="fl ml38 devide_class task-hide" data-tip-down="<%=group.name %>"><%=group.name %></span>
<% if count > 0 %>
<span class="fl ml10 color-grey-9 font-12 groupNum"><%= count %></span>

@ -9,6 +9,7 @@
<th width="6%">普通作业</th>
<th width="5%">实训作业</th>
<th width="4%">试卷</th>
<th width="6%">评测次数</th>
<th width="4%">私有</th>
<th width="7%">状态</th>
<th width="8%" class="edu-txt-left">创建者单位</th>
@ -28,6 +29,7 @@
<td><%= course.homework_commons.where(:homework_type => 1).count %></td>
<td><%= course.homework_commons.where(:homework_type => 4).count %></td>
<td><%= course.exercises.count %></td>
<td><%= course.evaluate_count %></td>
<td><%= course.is_public.to_i == 1 ? '--' : '√' %></td>
<td><%= course.is_end ? "已结束" : "正在进行" %></td>
<td class="edu-txt-left"><%= course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.try(:user_extensions).try(:school) %></td>

@ -16,13 +16,14 @@
<th width="12%">开始时间<i class="fa fa-long-arrow-down color-light-green ml5" ></i></th>
<th width="12%">结束时间</th>
<th width="8%">耗时</th>
<th width="10%">评测者</th>
<th width="8%">最大执行时间</th>
<th width="8%">评测者</th>
<th width="10%">评测者单位</th>
<th width="5%">耗时详细</th>
</tr>
</thead>
<tbody>
<% @evaluate_recods.each do |record| %>
<% @evaluate_recods.includes(:shixun).each do |record| %>
<tr>
<td><%= record.id %></td>
<td><a href="/tasks/<%= record.game.try(:identifier) %>" target="_blank"><%= record.game.try(:identifier) %></a></td>
@ -33,6 +34,7 @@
<td><%= record.created_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
<td><%= record.updated_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
<td><%= record.try(:consume_time) %></td>
<td><%= record.shixun.exec_time %></td>
<td class="task-hide" title="<%= record.user.show_real_name %>">
<%= link_to record.user.show_real_name, user_path(record.user), :target => "_blank" %>
</td>

@ -1,20 +1,22 @@
<li class="clearfix tableHead">
<span>序号</span>
<span>客户名称</span>
<span><a href="<%= customers_list_managements_path(:partner_id => @current_partner.try(:id)) %>"
data-remote="true" class="color-blue">+添加</a></span>
<span>
<a href="<%= customers_list_managements_path(:partner_id => @current_partner.try(:id)) %>"
data-remote="true" class="color-blue">+添加</a>
</span>
<span>添加时间</span>
</li>
<% @current_partner.try(:customers).try(:each_with_index) do |customer, index| %>
<li>
<span><%= index + 1 %></span>
<span class="task-hide"><%= customer.school.name %></span>
<a href="<%= customer.school.statistic_url %>" target="_blank" class="color-blue"><%= customer.school.name %></a>
<span>
<a href="javascript:void(0)" onclick="delete_confirm_box_2('<%= delete_customers_managements_path(customer: customer.id, partner_id: @current_partner.try(:id)) %>',
'确定要删除该客户吗')" class="color-grey-9">删除</a>
</span>
<a href="javascript:void(0)" onclick="delete_confirm_box_2('<%= delete_customers_managements_path(customer: customer.id, partner_id: @current_partner.try(:id)) %>',
'确定要删除该客户吗')" class="color-grey-9">删除</a>
</span>
<span>
<%= format_time customer.created_at %>
</span>
</li>
<% end %>
<% end %>

@ -4,7 +4,7 @@
<div class="fr mr10 edu-menu-panel mt5">
<i class="iconfont icon-sandian color-grey-9 font-14"></i>
<ul class="edu-menuSmall-list edu-txt-center">
<li><a href="<%= partners_managements_path(:partner => partner) %>">查看</a></li>
<li><a href="<%= partner_list_cooperate_path partner %>">查看</a></li>
<li><a href="javascript:void(0)" onclick="delPartners('<%= delete_partner_managements_path(:partner_id => partner) %>');">删除</a></li>
</ul>
</div>

@ -1,14 +1,21 @@
<div class="edu-class-container">
<%= form_tag(url_for(evaluate_records_managements_path),:id=>"evaluate_records",:method => "post",:remote=>true) do %>
<div class="edu-con-top clearfix xmt10">
<div class="edu-con-top clearfix mb20 bor-grey-e mt10">
<select class="fl task-form-15 task-height-30" style="margin:20px 0px 10px 25px;width: 11%" name="keyword" id="condition">
<option value="u_name">评测者姓名搜索</option>
<option value="s_name">评测者单位搜索</option>
</select>
<input class="fl task-form-20 task-height-30 mt20 ml20" name="search" maxlength="40" placeholder="输入关键字进行搜索" type="text" id="Look_name">
<li class="fl mt20">
<span class="mr10 ml10 font-14">开始时间</span>
<input type="text" name="beginTime" placeholder="请选择开始时间" class="winput-150-30 mr10"/>
<input type="text" name="endTime" placeholder="请选择结束时间" class="winput-150-30"/>
</li>
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mt20" onclick="$('#evaluate_records').submit();">搜索</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 mt20" id="clear_contents">清除</a>
</div>
<% end %>
</div>
<div class="edu-con-bg01 mt15" id="evaluate_records_list">
<%= render :partial => "evaluate_records_list" %>
</div>
@ -19,4 +26,17 @@
$("#Look_name").val("");
$.get('<%= evaluate_records_managements_path() %>');
}
$("input[name='beginTime']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
$("input[name='endTime']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
</script>

@ -0,0 +1,78 @@
<% if false %>
<style>
.manage_ol ol li{list-style-type: disc;}
</style>
<div class="task-popup" style="width:400px;">
<div class=" task-popup-title clearfix task-popup-bggrey">
<h3 class="fl ">耗时详情</h3>
<a href="javascript:void(0)" id="closeIcon" style="top: -48px;right: -20px;z-index: 100000;"><i class="iconfont icon-shanchudiao"></i></a>
</div>
<div class="task_popup_con manage_ol">
<ol class="pl30">
<li>总耗时:<%= @consume_time %></li>
<li>作品更新:<%= @student_work %></li>
<li>文件更新:<%= @file_update %></li>
<li>中间层总耗时:<%= @brige %></li>
<li class="ml15">pull代码<%= @git_pull %></li>
<li class="ml15">pod启动<%= @create_pod %></li>
<li class="ml15">pod执行<%= @pod_execute %></li>
<li>中间层回传:<%= @return_back %>--中间层出结果传Educoder</li>
<li>前端轮询:<%= @front_js %>--局部数据查询Js轮询</li>
<li>回调结果存储:<%= @test_cases %></li>
</ol>
</div>
</div>
<% end %>
<% if @recodes.present? %>
<div class="edu-con-bg01 mt15" id="evaluate_records_list">
<table class="edu-pop-table edu-txt-center" cellpadding="0" cellspacing="0" style="table-layout: fixed">
<thead>
<tr>
<th width="5%">序号</th>
<th width="10%">总耗时<i class="fa fa-long-arrow-down color-light-green ml5" ></i></th>
<th width="5%">作品更新</th>
<th width="5%">文件更新</th>
<th width="10%">中间层总耗时</th>
<th width="5%">pull代码</th>
<th width="5%">pod启动</th>
<th width="5%">pod执行</th>
<th width="10%">中间层回传</th>
<th width="5%">前端轮询</th>
<th width="10%">回调结果存储</th>
<th width="15%">创建时间</th>
<th width="15%">实训名称</th>
</tr>
</thead>
<tbody>
<% @recodes.each_with_index do |record, index| %>
<tr>
<td><%= index %></td>
<td><%= record.consume_time %></td>
<td><%= record.student_work %></td>
<td><%= record.file_update %></td>
<td><%= record.brige %></td>
<td><%= record.git_pull %></td>
<td><%= record.create_pod %></td>
<td><%= record.pod_execute %></td>
<td><%= record.return_back %></td>
<td><%= record.front_js %></td>
<td><%= record.test_cases %></td>
<td><%= format_time record.created_at %></td>
<td><%= link_to record.shixun.try(:name), task_path(record.game), :target => "_blank", :title => "#{record.shixun.try(:name)}" %></td>
</tr>
<% end %>
</tbody>
</table>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @record_pages, @recodes_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
<% end %>

@ -3,7 +3,8 @@
<% if params[:grow_begin_date].present? %>
<%= params[:grow_date_input] %>
<% else %>
昨日至今日,
<%= (Time.current - 5.hour).beginning_of_day.ago(1.days).strftime('%Y-%m-%d') %> 05:00至
<%= (Time.current - 5.hour).beginning_of_day.strftime('%Y-%m-%d') %> 05:00
<% end %>
新增教师<span class="color-red"><%= @grow_summary.teacher_increase_count || 0 %></span>人,
新增学生<span class="color-red"><%= @grow_summary.student_increase_count || 0 %></span>人,

@ -130,7 +130,10 @@
if($("#unit_head_route").val().trim() !=""){
$.ajax({
url: "<%= verification_school_identifier_colleges_path %>",
data: {identifier: $("#unit_head_route").val().trim()},
data: {
school_id: <%= @school.id %>,
identifier: $("#unit_head_route").val().trim()
},
async:false,
success: function (data) {
if(data.status == 0){

@ -28,7 +28,8 @@
<td>
<a href="/users/<%= (student_work.user.try(:login)) %>" class="color-grey3"><%= student_work.user.show_real_name %></a>
</td>
<% group_name = new_member_group_name @course.id, student_work.user_id %>
<% group_id = @members.select{|m|m.user_id==student_work.user_id}.first.try(:course_group_id) %>
<% group_name = group_id.to_i == 0 ? '未分班' : @course.course_groups.find_by_id(group_id).name %>
<td title="<%= group_name %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= group_name %></span>
</td>

@ -33,7 +33,8 @@
<td>
<a href="/users/<%= (student_work.user.try(:login)) %>" class="color-grey3"><%= student_work.user.show_real_name %></a>
</td>
<% group_name = member_group_name @homework.course.members, student_work.user_id %>
<% group_id = @members.select{|m|m.user_id==student_work.user_id}.first.try(:course_group_id) %>
<% group_name = group_id.to_i == 0 ? '未分班' : @course.course_groups.find_by_id(group_id).name %>
<td title="<%= group_name %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= group_name %></span>
</td>

@ -25,8 +25,8 @@
<td>
<a href="/users/<%= (student_work.user.try(:login)) %>" class="color-grey3"><%= student_work.user.show_real_name %></a>
</td>
<% member = Member.find_by_sql("select course_group_id from members where course_id = #{@homework.course_id} and user_id = #{student_work.user_id}").first %>
<% group_name = member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name %>
<% group_id = @members.select{|m|m.user_id==student_work.user_id}.first.try(:course_group_id) %>
<% group_name = group_id.to_i == 0 ? '未分班' : @course.course_groups.find_by_id(group_id).name %>
<td title="<%= group_name %>">
<span class="task-hide"><%= group_name %></span>
</td>
@ -35,7 +35,7 @@
<%= student_id %>
</td>
<td>
<% status = list_work_status student_work, @homework, member %>
<% status = list_work_status student_work, @homework, group_id %>
<span class='<%= status == "未提交" ? "" : ((status == "按时提交" || status == "正在提交") ? "color-light-green" : "color-red") %>'><%= status %></span>
</td>
<td data-tip-down='<%= student_work.compelete_status == 0 ? "还未完成" : (student_work.compelete_status == 2 ? "已于发布前完成作品" : "自发布#{work_spend_time(student_work.cost_time)}后提交了最终作品") %>'>

@ -101,16 +101,16 @@
<% end %>
<%= link_to "导出成绩", student_work_index_path(:homework => @homework.id, :order => @order, :sort => @b_sort, :name => @name, :group => @group, :comment => @comment, :status => @status, :format => 'xls'), :class => 'fr mt3 ml15 white-btn orange-btn', :id => "export_student_work" %>
<% if @homework.homework_detail_manual.try(:comment_status) == 0 || @homework.homework_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").count > 0 %>
<% if @homework.homework_detail_manual.try(:comment_status) == 0 || @homework.homework_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").size > 0 %>
<%= link_to '立即发布', publish_notice_homework_common_path(@homework), :remote => true, :class => "white-btn orange-btn fr ml15 mt3" %>
<% end %>
<% if (@homework.homework_detail_manual.try(:comment_status) == 1 && @homework.end_time > Time.now) || @homework.homework_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").count > 0 %>
<% if (@homework.homework_detail_manual.try(:comment_status) == 1 && @homework.end_time > Time.now) || @homework.homework_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").size > 0 %>
<%= link_to '立即截止', end_notice_homework_common_path(@homework), :remote => true, :class => "white-btn orange-btn fr ml15 mt3" %>
<% end %>
<% if @homework.publish_time.present? && @homework.publish_time < Time.now && @homework.end_time > Time.now && (@homework.homework_type == 1 || @homework.homework_type == 3) %>
<a href="javascript:void(0)" class="white-btn orange-btn fr ml15 mt3" onclick="cancel_publish('<%= cancel_publish_homework_common_path(@homework) %>')">撤销发布</a>
<% end %>
<% if @homework.homework_type == 4 && @homework.publish_time.present? && @homework.publish_time < Time.now && @homework.homework_group_reviews.count == 0 %>
<% if @homework.homework_type == 4 && @homework.publish_time.present? && @homework.publish_time < Time.now && @homework.homework_group_reviews.size == 0 %>
<a href="<%= homework_code_repeat_homework_common_path(@homework) %>" data-remote="true" class="fr white-btn edu-greenline-btn ml15 mt3">代码查重</a>
<% end %>
</div>
@ -186,7 +186,7 @@
<span class="fl mr25">
<a href="javascript:void(0);" id="comment_no_limit" class="<%= @comment.blank? ? 'check_on' : '' %> pl10 pr10">不限</a>
</span>
<% has_comment = StudentWorksScore.where(:student_work_id => student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count %>
<% has_comment = StudentWorksScore.where(:student_work_id => student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).size %>
<input id="not_comment" class="magic-checkbox fl" type="checkbox" value="0" name="comment[]" <%= !@comment.blank? && @comment.include?('0') ? 'checked' : '' %>>
<label for="not_comment" class="fl mr25">未评(<%= @student_work_count - has_comment %>)</label>
<input id="has_comment" class="magic-checkbox fl" type="checkbox" value="1" name="comment[]" <%= !@comment.blank? && @comment.include?('1') ? 'checked' : '' %>>
@ -207,6 +207,7 @@
<input id="work_status_3" class="magic-checkbox fl" type="checkbox" value="2" name="status[]" <%= !@status.blank? && @status.include?('2') ? 'checked' : '' %>>
<label for="work_status_3" class="fl mr25">延时提交(<%= student_works.where(:work_status => 2).count %>
)</label>
</li>
<li class="clearfix">
<span class="fl mr10 color-grey-8">分班情况:</span>
@ -214,7 +215,7 @@
<a href="javascript:void(0);" id="group_no_limit" class="<%= @group.blank? ? 'check_on' : '' %> pl10 pr10">不限</a>
</span>
<p class="fl pb10" style="display: block;max-width: 995px;">
<% groups.each do |group| %>
<% groups.includes(:members).each do |group| %>
<input id="group_<%= group.id %>" class="magic-checkbox fl" type="checkbox" value="<%= group.id %>" name="group[]" <%= !@group.blank? && @group.include?(group.id) ? 'checked' : '' %>>
<label for="group_<%= group.id %>" class="fl mr25"><%= group.name %>
(<%= group.members.count %>)</label>
@ -264,7 +265,7 @@
<% my_work = cur_user_works_for_homework @homework %>
<% if @homework.homework_detail_manual.comment_status == 3 %>
<% unless my_work.nil? %>
<% if my_work.user.student_works_evaluation_distributions.where(:student_work_id => @homework.student_works.map(&:id)).count != 0 %>
<% if my_work.user.student_works_evaluation_distributions.where(:student_work_id => @homework.student_works.map(&:id)).size != 0 %>
<span class="edu-filter-btn edu-filter-btn-orange mb15">你在匿评开启之前提交了作品,你的作品正在匿评中</span>
<% else %>
<span class="edu-filter-btn edu-filter-btn-orange mb15">你在匿评开启之后才提交作品,你的作品没有参与匿评</span>
@ -287,8 +288,8 @@
<% end %>
<p class="color-grey-8 font-12 clearfix mb15">
<span class=""><%= @homework.student_works.where("work_status != 0").count %> 已交</span>
<span class="ml30"><%= @homework.course.student.count - @homework.student_works.where("work_status != 0").size %>
<span class=""><%= @homework.student_works.where("work_status != 0").size %> 已交</span>
<span class="ml30"><%= @homework.course.student.size - @homework.student_works.where("work_status != 0").size %>
未交</span>
<% if @homework.homework_detail_manual %>
<% if @homework.homework_detail_manual.comment_status == 1 %>

@ -37,7 +37,7 @@
<% if comment_status == 0 || activity.homework_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").count > 0 %>
<li><%= link_to '立即发布', publish_notice_homework_common_path(activity), :remote => true %></li>
<% end %>
<% if (comment_status == 1 && activity.end_time > Time.now) || activity.homework_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").count > 0 %>
<% if (comment_status == 1 && activity.end_time && activity.end_time > Time.now) || activity.homework_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").count > 0 %>
<li><%= link_to '立即截止', end_notice_homework_common_path(activity), :remote => true %></li>
<% end %>
<li><%= link_to "导出成绩", student_work_index_path(:homework => activity, :format => 'xls'), :id => "export_student_work" %></li>

@ -523,6 +523,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
resources :managements do
collection do
get 'evaluate_simple'
get 'hidden_course'
match 'training_2018',:via=>[:get,:post]
get 'update_pay_status'

@ -0,0 +1,8 @@
class AddIdentifierToEvaluateRecords < ActiveRecord::Migration
def change
add_column :evaluate_records, :identifier, :string
add_index :evaluate_records, :identifier, unique: true
remove_index :evaluate_records, :name => :game
remove_index :evaluate_records, :name => :index_evaluate_records_on_user_id
end
end
Loading…
Cancel
Save