parent
6784a2e4b9
commit
fe9e244e42
@ -1,11 +0,0 @@
|
|||||||
$(document).on('turbolinks:load', function () {
|
|
||||||
if ($('body.admins-projects-index-page').length > 0) {
|
|
||||||
var $form = $('.search-form');
|
|
||||||
|
|
||||||
// 清空
|
|
||||||
$form.on('click', '.clear-btn', function () {
|
|
||||||
$form.find('input[name="search"]').val('');
|
|
||||||
$form.find('input[type="submit"]').trigger('click');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,12 +0,0 @@
|
|||||||
$(document).on('turbolinks:load', function () {
|
|
||||||
if ($('body.admins-shixun-modify-records-index-page').length > 0) {
|
|
||||||
var $form = $('.search-form');
|
|
||||||
|
|
||||||
// 清空
|
|
||||||
$form.on('click', '.clear-btn', function () {
|
|
||||||
$form.find('select[name="date"]').val('weekly');
|
|
||||||
$form.find('input[name="user_name"]').val('');
|
|
||||||
$form.find('input[type="submit"]').trigger('click');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,14 +0,0 @@
|
|||||||
.diff{overflow:auto;}
|
|
||||||
.diff ul{background:#fff;overflow:auto;font-size:13px;list-style:none;margin:0;padding:0 1rem;display:table;width:100%;}
|
|
||||||
.diff del, .diff ins{display:block;text-decoration:none;}
|
|
||||||
.diff li{padding:0; display:table-row;margin: 0;height:1em;}
|
|
||||||
.diff li.ins{background:#dfd; color:#080}
|
|
||||||
.diff li.del{background:#fee; color:#b00}
|
|
||||||
.diff li:hover{background:#ffc}
|
|
||||||
|
|
||||||
/* try 'whitespace:pre;' if you don't want lines to wrap */
|
|
||||||
.diff del, .diff ins, .diff span{white-space:pre-wrap;font-family:courier;}
|
|
||||||
.diff del strong{font-weight:normal;background:#fcc;}
|
|
||||||
.diff ins strong{font-weight:normal;background:#9f9;}
|
|
||||||
.diff li.diff-comment { display: none; }
|
|
||||||
.diff li.diff-block-info { background: none repeat scroll 0 0 gray; }
|
|
@ -1,7 +0,0 @@
|
|||||||
.admins-shixun-feedback-messages-index-page {
|
|
||||||
.content-img {
|
|
||||||
img {
|
|
||||||
height: 60px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
class Admins::ShixunModifyRecordsController < Admins::BaseController
|
|
||||||
|
|
||||||
def index
|
|
||||||
records = Admins::ShixunModifyRecordQuery.call(params)
|
|
||||||
|
|
||||||
@records = paginate records.includes(:diff_record_content)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,175 +0,0 @@
|
|||||||
class CollegesController < ApplicationController
|
|
||||||
include PaginateHelper
|
|
||||||
|
|
||||||
# layout 'college'
|
|
||||||
|
|
||||||
before_action :require_login
|
|
||||||
before_action :check_college_present!
|
|
||||||
before_action :check_manage_permission!
|
|
||||||
|
|
||||||
helper_method :current_school, :current_college
|
|
||||||
|
|
||||||
def statistics
|
|
||||||
# 教师、学生总数
|
|
||||||
count_statistic = UserExtension.where(school_id: current_school.id)
|
|
||||||
.select('SUM(IF(identity=0, 1, 0)) AS teachers_count, SUM(IF(identity=1, 1, 0)) AS students_count').first
|
|
||||||
@teachers_count = count_statistic['teachers_count']
|
|
||||||
@students_count = count_statistic['students_count']
|
|
||||||
|
|
||||||
# 课堂总数
|
|
||||||
@courses_count = Course.where(school_id: current_school.id, is_delete: 0).where.not(id: 1309).count
|
|
||||||
# 实训总数
|
|
||||||
@shixuns_count = Shixun.visible.joins('left join user_extensions on user_extensions.user_id = shixuns.user_id')
|
|
||||||
.where(user_extensions: { school_id: current_school.id }).count
|
|
||||||
render json: { teachers_count: @teachers_count, students_count: @students_count, courses_count: @courses_count, shixuns_count: @shixuns_count, school: current_school.name }
|
|
||||||
end
|
|
||||||
|
|
||||||
def shixun_time
|
|
||||||
time_sum = Game.joins('left join user_extensions on user_extensions.user_id = games.user_id')
|
|
||||||
.where(user_extensions: { school_id: current_school.id }).sum(:cost_time)
|
|
||||||
shixun_time_sum = (time_sum / (24 * 60 * 60.0)).ceil
|
|
||||||
|
|
||||||
render json: { shixun_time: shixun_time_sum }
|
|
||||||
end
|
|
||||||
|
|
||||||
def shixun_report_count
|
|
||||||
shixun_report_count = StudentWork.where(work_status: [1, 2]).where('myshixun_id != 0')
|
|
||||||
.joins('left join user_extensions on user_extensions.user_id = student_works.user_id')
|
|
||||||
.where(user_extensions: { school_id: current_school.id }).count
|
|
||||||
render json: { shixun_report_count: shixun_report_count }
|
|
||||||
end
|
|
||||||
|
|
||||||
def teachers
|
|
||||||
@teachers = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, IFNULL((SELECT count(shixuns.id) FROM shixuns where shixuns.user_id =users.id group by shixuns.user_id), 0) AS publish_shixun_count,
|
|
||||||
(SELECT count(c.id) FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.user_id=users.id AND m.role in (1,2,3) and c.school_id = #{current_school.id} AND c.is_delete = 0) as course_count
|
|
||||||
FROM `users`, user_extensions ue where ue.school_id=#{current_school.id} and users.id=ue.user_id and ue.identity=0 ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10")
|
|
||||||
# ).order("publish_shixun_count desc, experience desc").limit(10)
|
|
||||||
# @teacher_count = UserExtension.where(school_id: current_school.id)
|
|
||||||
# .select('SUM(IF(identity=0, 1, 0)) AS teachers_count').first.teachers_count
|
|
||||||
@teachers =
|
|
||||||
@teachers.map do |teacher|
|
|
||||||
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{current_school.id}")
|
|
||||||
course_count = course_ids.size
|
|
||||||
homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id))
|
|
||||||
un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count
|
|
||||||
shixun_work_count = homeworks.size - un_shixun_work_count
|
|
||||||
student_count = StudentsForCourse.where(:course_id => course_ids.map(&:id)).count
|
|
||||||
myshixun_ids = StudentWork.select("myshixun_id").where("homework_common_id in (#{homeworks.map(&:id).join(',').strip == "" ? -1 : homeworks.map(&:id).join(',')}) and myshixun_id is not null")
|
|
||||||
complete_myshixun = Myshixun.select("id").where(:status => 1, :id => myshixun_ids.map(&:myshixun_id)).size
|
|
||||||
all_myshixun = Myshixun.select("id").where(:id => myshixun_ids.map(&:myshixun_id)).size
|
|
||||||
complete_rate = all_myshixun == 0 ? 0 : ((complete_myshixun * 100) / all_myshixun).try(:round, 2).to_f
|
|
||||||
real_name = teacher.show_real_name
|
|
||||||
teacher = teacher.attributes.dup.merge({
|
|
||||||
real_name: real_name,
|
|
||||||
course_count: course_count,
|
|
||||||
shixun_work_count: shixun_work_count,
|
|
||||||
un_shixun_work_count: un_shixun_work_count,
|
|
||||||
student_count: student_count,
|
|
||||||
complete_rate: complete_rate
|
|
||||||
}).to_json
|
|
||||||
JSON.parse(teacher)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def shixun_chart_data
|
|
||||||
shixun_ids = HomeworkCommonsShixun.joins(homework_common: :course).where(courses: {school_id: current_school.id, is_delete: 0}).where('courses.id != 1309').pluck('distinct shixun_id')
|
|
||||||
shixun_count_map = ShixunTagRepertoire.joins(:tag_repertoire).where(shixun_id: shixun_ids).group('tag_repertoires.name').order('count_shixun_id desc').count(:shixun_id)
|
|
||||||
|
|
||||||
names = []
|
|
||||||
data = []
|
|
||||||
shixun_count_map.each do |name, count|
|
|
||||||
break if names.size == 9
|
|
||||||
|
|
||||||
names << name
|
|
||||||
data << { value: count, name: name }
|
|
||||||
end
|
|
||||||
|
|
||||||
if shixun_count_map.keys.size > 9
|
|
||||||
other_count = shixun_count_map.values[9..-1].reduce(:+)
|
|
||||||
names << 'Others'
|
|
||||||
data << { name: 'Others', value: other_count }
|
|
||||||
end
|
|
||||||
|
|
||||||
render json: { names: names, data: data }
|
|
||||||
end
|
|
||||||
|
|
||||||
# 在线课堂
|
|
||||||
def course_statistics
|
|
||||||
courses = Course.where(school_id: current_school.id, is_delete: 0).where.not(id: 1309)
|
|
||||||
|
|
||||||
@course_count = courses.size
|
|
||||||
courses = courses.left_joins(practice_homeworks: { student_works: { myshixun: :games } })
|
|
||||||
.select('courses.id, courses.name, courses.is_end, IFNULL(sum(games.evaluate_count), 0) evaluating_count')
|
|
||||||
.group('courses.id').order('is_end asc, evaluating_count desc')
|
|
||||||
|
|
||||||
@courses = paginate courses
|
|
||||||
|
|
||||||
course_ids = @courses.map(&:id)
|
|
||||||
@student_count = StudentsForCourse.where(course_id: course_ids).group(:course_id).count
|
|
||||||
@shixun_work_count = HomeworkCommon.where(homework_type: 4, course_id: course_ids).group(:course_id).count
|
|
||||||
@attachment_count = Attachment.where(container_id: course_ids, container_type: 'Course').group(:container_id).count
|
|
||||||
@message_count = Message.joins(:board).where(boards: { parent_id: 0, course_id: course_ids }).group('boards.course_id').count
|
|
||||||
@active_time = CourseActivity.where(course_id: course_ids).group(:course_id).maximum(:created_at)
|
|
||||||
@exercise_count = Exercise.where(course_id: course_ids).group(:course_id).count
|
|
||||||
@poll_count = Poll.where(course_id: course_ids).group(:course_id).count
|
|
||||||
@other_work_count = HomeworkCommon.where(homework_type: [1,3], course_id: course_ids).group(:course_id).count
|
|
||||||
end
|
|
||||||
|
|
||||||
# 学生实训
|
|
||||||
def student_shixun
|
|
||||||
# @student_count = User.joins(:user_extension).where(user_extensions: { school_id: current_school.id, identity: 1 }).count
|
|
||||||
@students = User.joins(:user_extension).where(user_extensions: { school_id: current_school.id, identity: 1 }).includes(:user_extension).order('experience desc').limit(10)
|
|
||||||
|
|
||||||
student_ids = @students.map(&:id)
|
|
||||||
@shixun_count = Myshixun.where(user_id: student_ids).group(:user_id).count
|
|
||||||
@study_shixun_count = Myshixun.where(user_id: student_ids, status: 0).group(:user_id).count
|
|
||||||
end
|
|
||||||
|
|
||||||
def student_hot_evaluations
|
|
||||||
games = Game.joins(:myshixun).joins('join shixun_tag_repertoires str on str.shixun_id = myshixuns.shixun_id')
|
|
||||||
games = games.joins('join tag_repertoires tr on tr.id = str.tag_repertoire_id')
|
|
||||||
games = games.joins("join user_extensions ue on ue.user_id = myshixuns.user_id and ue.school_id = #{current_school.id}")
|
|
||||||
evaluate_count_map = games.group('tr.name').reorder('sum_games_evaluate_count desc').limit(10).sum('games.evaluate_count')
|
|
||||||
|
|
||||||
render json: { names: evaluate_count_map.keys, values: evaluate_count_map.values }
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def require_login
|
|
||||||
return if User.current.logged?
|
|
||||||
|
|
||||||
redirect_to "/login?back_url=#{CGI::escape(request.fullpath)}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_college_present!
|
|
||||||
return if current_college.present?
|
|
||||||
|
|
||||||
redirect_to '/404'
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_manage_permission!
|
|
||||||
return if can_manage_college?
|
|
||||||
|
|
||||||
redirect_to '/403'
|
|
||||||
end
|
|
||||||
|
|
||||||
def can_manage_college?
|
|
||||||
return true if current_user.admin_or_business? # 超级管理员|运营
|
|
||||||
return true if current_college.is_a?(Department) && current_college.member?(current_user) # 部门管理员
|
|
||||||
return true if current_user.is_teacher? && current_user.school_id == current_school.id # 学校老师
|
|
||||||
# return true if current_school.customers.exists? && current_user.partner&.partner_customers&.exists?(customer_id: current_school.customer_id)
|
|
||||||
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
def current_school
|
|
||||||
current_college.is_a?(School) ? current_college : current_college.school
|
|
||||||
end
|
|
||||||
|
|
||||||
def current_college
|
|
||||||
@_current_college ||= begin
|
|
||||||
Department.find_by(identifier: params[:id]) || School.find_by(id: params[:id])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,32 +0,0 @@
|
|||||||
module LaboratoryHelper
|
|
||||||
extend ActiveSupport::Concern
|
|
||||||
|
|
||||||
included do
|
|
||||||
before_action :setup_laboratory
|
|
||||||
|
|
||||||
helper_method :current_laboratory
|
|
||||||
helper_method :default_setting
|
|
||||||
helper_method :default_yun_session
|
|
||||||
end
|
|
||||||
|
|
||||||
def current_laboratory
|
|
||||||
@_current_laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
|
|
||||||
end
|
|
||||||
|
|
||||||
def default_laboratory
|
|
||||||
@_default_laboratory ||= Laboratory.find(1)
|
|
||||||
end
|
|
||||||
|
|
||||||
def default_setting
|
|
||||||
@_default_setting ||= LaboratorySetting.find_by(laboratory_id: 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
def setup_laboratory
|
|
||||||
Laboratory.current = current_laboratory
|
|
||||||
end
|
|
||||||
|
|
||||||
def default_yun_session
|
|
||||||
laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
|
|
||||||
@_default_yun_session = "#{laboratory.try(:identifier).split('.').first}_user_id"
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,14 +0,0 @@
|
|||||||
class LibrariesController < ApplicationController
|
|
||||||
include PaginateHelper
|
|
||||||
|
|
||||||
def index
|
|
||||||
default_sort('updated_at', 'desc')
|
|
||||||
|
|
||||||
@items = ItemBankQuery.call(params)
|
|
||||||
@items = paginate courses.includes(:school, :students, :attachments, :homework_commons, teacher: :user_extension)
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
class JupytersController < ApplicationController
|
|
||||||
include JupyterService
|
|
||||||
|
|
||||||
before_action :shixun, only: [:open, :open1, :test, :save]
|
|
||||||
|
|
||||||
def save_with_tpi
|
|
||||||
myshixun = Myshixun.find_by(identifier: params[:identifier])
|
|
||||||
jupyter_save_with_game(myshixun, params[:jupyter_port])
|
|
||||||
render json: {status: 0}
|
|
||||||
end
|
|
||||||
|
|
||||||
def save_with_tpm
|
|
||||||
shixun = Shixun.find_by(identifier: params[:identifier])
|
|
||||||
jupyter_save_with_shixun(shixun, params[:jupyter_port])
|
|
||||||
render json: {status: 0}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_info_with_tpi
|
|
||||||
myshixun = Myshixun.find_by(identifier: params[:identifier])
|
|
||||||
url = jupyter_url_with_game(myshixun)
|
|
||||||
port = jupyter_port_with_game(myshixun)
|
|
||||||
render json: {status: 0, url: url, port: port}
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_info_with_tpm
|
|
||||||
shixun = Shixun.find_by(identifier: params[:identifier])
|
|
||||||
url = jupyter_url_with_shixun(shixun)
|
|
||||||
port = jupyter_port_with_shixun(shixun)
|
|
||||||
render json: {status: 0, url: url, port: port}
|
|
||||||
end
|
|
||||||
|
|
||||||
def reset_with_tpi
|
|
||||||
myshixun = Myshixun.find_by(identifier: params[:identifier])
|
|
||||||
info = jupyter_tpi_reset(myshixun)
|
|
||||||
render json: {status: 0, url: info[:url], port: info[:port]}
|
|
||||||
end
|
|
||||||
|
|
||||||
def reset_with_tpm
|
|
||||||
shixun = Shixun.find_by(identifier: params[:identifier])
|
|
||||||
info = jupyter_tpm_reset(shixun)
|
|
||||||
render json: {status: 0, url: info[:url], port: info[:port]}
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
@ -1,3 +0,0 @@
|
|||||||
module Admins::BaseHelper
|
|
||||||
include ManageBackHelper
|
|
||||||
end
|
|
@ -1,10 +0,0 @@
|
|||||||
module Admins::CompetitionPrizeUsersHelper
|
|
||||||
def display_auth_state(flag, other = false, success: nil, normal: nil, error: nil)
|
|
||||||
success ||= '<i class="fa fa-check text-success font-16"/>'.html_safe
|
|
||||||
normal ||= '--'
|
|
||||||
error ||= '<i class="fa fa-close text-secondary font-16"/>'.html_safe
|
|
||||||
|
|
||||||
return success if flag
|
|
||||||
other ? normal : error
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,3 +0,0 @@
|
|||||||
class ItemAnalysis < ApplicationRecord
|
|
||||||
belongs_to :item_bank
|
|
||||||
end
|
|
@ -1,11 +0,0 @@
|
|||||||
class ItemBank < ApplicationRecord
|
|
||||||
# difficulty: 1 简单 2 适中 3 困难
|
|
||||||
# item_type: 0 单选 1 多选 2 判断 3 填空 4 简答 5 实训 6 编程
|
|
||||||
enum item_type: { SINGLE: 0, MULTIPLE: 1, JUDGMENT: 2, COMPLETION: 3, SUBJECTIVE: 4, PRACTICAL: 5, PROGRAM: 6 }
|
|
||||||
|
|
||||||
belongs_to :user
|
|
||||||
|
|
||||||
has_one :item_analysis, dependent: :destroy
|
|
||||||
has_many :item_choices, dependent: :destroy
|
|
||||||
has_many :item_baskets, dependent: :destroy
|
|
||||||
end
|
|
@ -1,4 +0,0 @@
|
|||||||
class ItemBasket < ApplicationRecord
|
|
||||||
belongs_to :item_bank
|
|
||||||
belongs_to :user
|
|
||||||
end
|
|
@ -1,3 +0,0 @@
|
|||||||
class ItemChoice < ApplicationRecord
|
|
||||||
belongs_to :item_bank
|
|
||||||
end
|
|
@ -1,33 +0,0 @@
|
|||||||
class Admins::ShixunModifyRecordQuery < ApplicationQuery
|
|
||||||
attr_reader :params
|
|
||||||
|
|
||||||
def initialize(params)
|
|
||||||
@params = params
|
|
||||||
end
|
|
||||||
|
|
||||||
def call
|
|
||||||
if params[:user_name].blank? || params[:date].blank?
|
|
||||||
records = DiffRecord.none
|
|
||||||
else
|
|
||||||
records = DiffRecord.joins(:user).where("concat(users.lastname, users.firstname) like ?", "%#{params[:user_name].strip}%")
|
|
||||||
if time_range.present?
|
|
||||||
records = records.where(created_at: time_range)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
records.order("diff_records.created_at desc")
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def time_range
|
|
||||||
@_time_range ||= begin
|
|
||||||
case params[:date]
|
|
||||||
when 'weekly' then 1.weeks.ago..Time.now
|
|
||||||
when 'monthly' then 1.months.ago..Time.now
|
|
||||||
when 'quarterly' then 3.months.ago..Time.now
|
|
||||||
when 'yearly' then 1.years.ago..Time.now
|
|
||||||
else ''
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,25 +0,0 @@
|
|||||||
<% define_admin_breadcrumbs do %>
|
|
||||||
<% add_admin_breadcrumb('实训修改记录') %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="box search-form-container shixun-modify-record-list-form">
|
|
||||||
<%= form_tag(admins_shixun_modify_records_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
|
||||||
<div class="form-group col-12 col-md-4">
|
|
||||||
<label for="user_name">用户名:</label>
|
|
||||||
<%= text_field_tag :user_name, params[:user_name], class: 'form-control flex-1', placeholder: '真实姓名搜索' %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group col-12 col-md-auto">
|
|
||||||
<label for="status">时间范围:</label>
|
|
||||||
<% data_arrs = [['最近一周', 'weekly'], ['最近一个月', 'monthly']] %>
|
|
||||||
<%= select_tag(:date, options_for_select(data_arrs, params[:date]), class: 'form-control') %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
|
||||||
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="box admin-list-container shixun-modify-record-list-container">
|
|
||||||
<%= render partial: 'admins/shixun_modify_records/shared/list', locals: { records: @records } %>
|
|
||||||
</div>
|
|
@ -1 +0,0 @@
|
|||||||
$('.shixun-modify-record-list-container').html("<%= j( render partial: 'admins/shixun_modify_records/shared/list', locals: { records: @records } ) %>");
|
|
@ -1,36 +0,0 @@
|
|||||||
<% if records.present? %>
|
|
||||||
<% records.each do |record| %>
|
|
||||||
<div class="card mb-5">
|
|
||||||
<div class="card-header font-16">
|
|
||||||
<span><%= record.user.real_name %></span>
|
|
||||||
<span class="ml-3"><%= format_time record.created_at %></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-2 mb-3 ml-3 font-14">
|
|
||||||
<span>实训名称:<%= record.container&.shixun&.name %></span>
|
|
||||||
<% if record.container_type == "Challenge" %>
|
|
||||||
<span class="ml-3">/</span>
|
|
||||||
<span class="ml-3">关卡名:<%= record.container&.subject %></span>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="diff font-12">
|
|
||||||
<ul>
|
|
||||||
<% record.diff_record_content&.content&.split("\n").each do |line| %>
|
|
||||||
<% if line =~ /^[\+]/ %>
|
|
||||||
<li class="ins"><ins><%= line %></ins></li>
|
|
||||||
<% elsif line =~ /^[\-]/ %>
|
|
||||||
<li class="del"><del><%= line %></del></li>
|
|
||||||
<% else %>
|
|
||||||
<li class="unchanged"><span><%= line %></span></li>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% else %>
|
|
||||||
<%= render 'admins/shared/no_data_for_table' %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= render partial: 'admins/shared/paginate', locals: { objects: records } %>
|
|
@ -1,11 +0,0 @@
|
|||||||
json.courses @courses do |course|
|
|
||||||
json.(course, :id, :name, :is_end, :evaluating_count)
|
|
||||||
json.teachers course.teacher_users.map(&:real_name).join('、')
|
|
||||||
json.student_count @student_count.fetch(course.id, 0)
|
|
||||||
json.shixun_work_count @shixun_work_count.fetch(course.id, 0)
|
|
||||||
json.attachment_count @attachment_count.fetch(course.id, 0)
|
|
||||||
json.message_count @message_count.fetch(course.id, 0)
|
|
||||||
json.other_work_count @exercise_count.fetch(course.id, 0) + @poll_count.fetch(course.id, 0) + @other_work_count.fetch(course.id, 0)
|
|
||||||
json.activity_time @active_time[course.id]&.strftime('%Y-%m-%d %H:%M')
|
|
||||||
end
|
|
||||||
json.course_count @course_count
|
|
@ -1,10 +0,0 @@
|
|||||||
json.teachers @students do |student|
|
|
||||||
json.login student.login
|
|
||||||
json.name student.real_name
|
|
||||||
json.student_id student.student_id
|
|
||||||
json.shixun_count @shixun_count.fetch(student.id, 0)
|
|
||||||
json.study_shixun_count @study_shixun_count.fetch(student.id, 0)
|
|
||||||
json.grade student.grade
|
|
||||||
json.experience student.experience
|
|
||||||
end
|
|
||||||
# json.student_count @student_count
|
|
@ -1,11 +0,0 @@
|
|||||||
json.teachers @teachers do |teacher|
|
|
||||||
json.login teacher['login']
|
|
||||||
json.name teacher['real_name']
|
|
||||||
json.course_count teacher['course_count']
|
|
||||||
json.shixun_work_count teacher['shixun_work_count']
|
|
||||||
json.un_shixun_work_count teacher['un_shixun_work_count']
|
|
||||||
json.student_count teacher['student_count']
|
|
||||||
json.complete_rate teacher['complete_rate']
|
|
||||||
json.publish_shixun_count teacher['publish_shixun_count']
|
|
||||||
end
|
|
||||||
# json.teacher_count @teacher_count
|
|
@ -1,7 +0,0 @@
|
|||||||
json.user do
|
|
||||||
json.partial! 'users/user', user: current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
json.(@shixun, :id, :identifier, :status, :name)
|
|
||||||
json.myshixun_identifier @myshixun.identifier
|
|
||||||
json.tpm_modified @tpm_modified
|
|
@ -1 +0,0 @@
|
|||||||
json.code @hack.code
|
|
@ -1,3 +0,0 @@
|
|||||||
json.user do
|
|
||||||
json.partial! 'users/user', user: current_user
|
|
||||||
end
|
|
@ -1,11 +0,0 @@
|
|||||||
json.data_sets do
|
|
||||||
json.array! @data_sets do |set|
|
|
||||||
json.id set.id
|
|
||||||
json.title set.title
|
|
||||||
json.author set.author.real_name
|
|
||||||
json.created_on set.created_on
|
|
||||||
json.filesize number_to_human_size(set.filesize)
|
|
||||||
json.file_path "#{@absolute_folder}/#{set.relative_path_filename}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
json.data_sets_count @data_count
|
|
@ -1 +0,0 @@
|
|||||||
json.identifier @myshixun.identifier
|
|
@ -1,6 +0,0 @@
|
|||||||
json.course_groups @course_groups.each do |group|
|
|
||||||
json.(group, :id, :course_members_count, :name)
|
|
||||||
end
|
|
||||||
|
|
||||||
json.none_group_member_count @course.none_group_count
|
|
||||||
json.group_count @all_group_count
|
|
@ -1,6 +0,0 @@
|
|||||||
class AddModifyTimeForHackCodes < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
add_column :hack_codes, :modify_time, :timestamp
|
|
||||||
add_column :hack_user_lastest_codes, :modify_time, :timestamp
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,6 +0,0 @@
|
|||||||
class AddIndexForHackCodes < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
HackCode.destroy_all
|
|
||||||
add_index :hack_codes, [:hack_id, :language], unique: true
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
class AddIsJupyterForShixuns < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
add_column :shixuns, :is_jupyter, :boolean, :default => false
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
class AddVipToShixun < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
add_column :shixuns, :vip, :boolean, default: 0
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,17 +0,0 @@
|
|||||||
class AddIndexForShixunSecretRepositories < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
shixun_ids = ShixunSecretRepository.pluck(:shixun_id).uniq
|
|
||||||
shixuns = Shixun.where(id: shixun_ids)
|
|
||||||
shixuns.find_each do |shixun|
|
|
||||||
id = shixun.shixun_secret_repository.id
|
|
||||||
shixun_secret_repositories = ShixunSecretRepository.where(shixun_id: shixun.id).where.not(id: id)
|
|
||||||
shixun_secret_repositories.destroy_all
|
|
||||||
end
|
|
||||||
|
|
||||||
remove_index :shixun_secret_repositories, :shixun_id
|
|
||||||
add_index :shixun_secret_repositories, :shixun_id, unique: true
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,7 +0,0 @@
|
|||||||
class ModifyTypeForTestSets < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
change_column :test_sets, :input, :longtext
|
|
||||||
change_column :test_sets, :output, :longtext
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
class AddPublicStatusToShixun < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
add_column :shixuns, :public, :integer, default: 0
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,9 +0,0 @@
|
|||||||
class MigrateShixunStatus < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
# 平台上所有已发布且未隐藏的实训都设为公开
|
|
||||||
Shixun.unhidden.update_all(public: 2)
|
|
||||||
|
|
||||||
# 所有已申请发布的实训状态都改为已发布,申请发布改为申请公开
|
|
||||||
Shixun.where(status: 1, id: ApplyAction.where(container_type: 'ApplyShixun', status: 0).pluck(:container_id)).update_all(status: 2, public: 1)
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
class ModifyTaskPassForShixuns < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
change_column :shixuns, :task_pass, :boolean, :default => true
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,16 +0,0 @@
|
|||||||
class CreateItemBanks < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
create_table :item_banks do |t|
|
|
||||||
t.text :name
|
|
||||||
t.references :curriculum, index: true
|
|
||||||
t.references :curriculum_direction, index: true
|
|
||||||
t.integer :item_type
|
|
||||||
t.integer :difficulty
|
|
||||||
t.references :user, index: true
|
|
||||||
t.boolean :public
|
|
||||||
t.integer :quotes
|
|
||||||
|
|
||||||
t.timestamps
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,10 +0,0 @@
|
|||||||
class CreateItemAnalyses < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
create_table :item_analyses do |t|
|
|
||||||
t.references :item_bank, index: true
|
|
||||||
t.text :analysis
|
|
||||||
|
|
||||||
t.timestamps
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,11 +0,0 @@
|
|||||||
class CreateItemChoices < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
create_table :item_choices do |t|
|
|
||||||
t.references :item_bank, index: true
|
|
||||||
t.text :choice_text
|
|
||||||
t.boolean :is_answer
|
|
||||||
|
|
||||||
t.timestamps
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,10 +0,0 @@
|
|||||||
class CreateItemBaskets < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
create_table :item_baskets do |t|
|
|
||||||
t.references :item_bank, index: true
|
|
||||||
t.references :user, index: true
|
|
||||||
|
|
||||||
t.timestamps
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,10 +0,0 @@
|
|||||||
class ModifyDescriptionForHacks < ActiveRecord::Migration[5.2]
|
|
||||||
def change
|
|
||||||
change_column :hacks, :description, :longtext
|
|
||||||
change_column :hack_codes, :code, :longtext
|
|
||||||
change_column :hack_user_lastest_codes, :code, :longtext
|
|
||||||
change_column :hack_user_codes, :code, :longtext
|
|
||||||
change_column :hack_user_debugs, :code, :longtext
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
Binary file not shown.
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe ItemAnalysis, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe ItemBank, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe ItemBasket, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe ItemChoice, type: :model do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
Loading…
Reference in new issue