diff --git a/app/assets/javascripts/admins/courses/index.js b/app/assets/javascripts/admins/courses/index.js
index 336d8c7c9..0e3473dff 100644
--- a/app/assets/javascripts/admins/courses/index.js
+++ b/app/assets/javascripts/admins/courses/index.js
@@ -26,6 +26,15 @@ $(document).on('turbolinks:load', function() {
});
});
+ // 清空
+ searchForm.on('click', '.clear-btn', function () {
+ searchForm.find('select[name="status"]').val('');
+ searchForm.find('.school-select').val('').trigger('change');
+ searchForm.find('input[name="keyword"]').val('');
+ searchForm.find('#homepage_show').attr('checked', false);
+ searchForm.find('input[type="submit"]').trigger('click');
+ });
+
// ************** 学校选择 *************
searchForm.find('.school-select').select2({
theme: 'bootstrap4',
diff --git a/app/assets/javascripts/admins/projects/index.js b/app/assets/javascripts/admins/projects/index.js
new file mode 100644
index 000000000..534a065ca
--- /dev/null
+++ b/app/assets/javascripts/admins/projects/index.js
@@ -0,0 +1,11 @@
+$(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');
+ });
+ }
+});
diff --git a/app/assets/javascripts/admins/shixun_feedback_messages/index.js b/app/assets/javascripts/admins/shixun_feedback_messages/index.js
index c0b32ba32..c25a6b744 100644
--- a/app/assets/javascripts/admins/shixun_feedback_messages/index.js
+++ b/app/assets/javascripts/admins/shixun_feedback_messages/index.js
@@ -1,12 +1,14 @@
$(document).on('turbolinks:load', function(){
if ($('body.admins-shixun-feedback-messages-index-page').length > 0) {
+ $(".content-img img").addClass("w-20").addClass("preview-image");
+
var baseOptions = {
autoclose: true,
language: 'zh-CN',
format: 'yyyy-mm-dd 00:00:00',
startDate: '2017-04-01'
- }
+ };
var defineDateRangeSelect = function(element){
var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, baseOptions);
@@ -14,9 +16,9 @@ $(document).on('turbolinks:load', function(){
$(element).find('.start-date').datepicker().on('changeDate', function(e){
$(element).find('.end-date').datepicker('setStartDate', e.date);
- })
+ });
};
defineDateRangeSelect('.grow-date-input-daterange');
}
-})
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/app/assets/javascripts/admins/shixun_modify_records/index.js b/app/assets/javascripts/admins/shixun_modify_records/index.js
new file mode 100644
index 000000000..13b348b04
--- /dev/null
+++ b/app/assets/javascripts/admins/shixun_modify_records/index.js
@@ -0,0 +1,12 @@
+$(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');
+ });
+ }
+});
diff --git a/app/assets/stylesheets/admins/diff.scss b/app/assets/stylesheets/admins/diff.scss
new file mode 100644
index 000000000..34944ae4c
--- /dev/null
+++ b/app/assets/stylesheets/admins/diff.scss
@@ -0,0 +1,14 @@
+.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; }
\ No newline at end of file
diff --git a/app/assets/stylesheets/admins/shixun_feedback_messages.scss b/app/assets/stylesheets/admins/shixun_feedback_messages.scss
new file mode 100644
index 000000000..92b92c01c
--- /dev/null
+++ b/app/assets/stylesheets/admins/shixun_feedback_messages.scss
@@ -0,0 +1,7 @@
+.admins-shixun-feedback-messages-index-page {
+ .content-img {
+ img {
+ height: 60px;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/constraint/admin_constraint.rb b/app/constraint/admin_constraint.rb
index 3ddf9a11e..2cf5649a7 100644
--- a/app/constraint/admin_constraint.rb
+++ b/app/constraint/admin_constraint.rb
@@ -1,7 +1,8 @@
class AdminConstraint
def matches?(request)
- return false unless request.session[:user_id]
- user = User.find request.session[:user_id]
+ laboratory = Laboratory.first
+ return false unless request.session[:"#{laboratory.try(:identifier).split('.').first}_user_id"]
+ user = User.find request.session[:"#{laboratory.try(:identifier).split('.').first}_user_id"]
user && user.admin?
end
end
\ No newline at end of file
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index f03cbdef8..23240fa75 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -38,6 +38,8 @@ class AccountsController < ApplicationController
return normal_status(-2, "验证码已失效") if !verifi_code&.effective?
end
+ return normal_status(-1, "8~16位密码,支持字母数字和符号") unless params[:password] =~ CustomRegexp::PASSWORD
+
code = generate_identifier User, 8, pre
login = pre + code
@user = User.new(admin: false, login: login, mail: email, phone: phone, type: "User")
@@ -114,6 +116,7 @@ class AccountsController < ApplicationController
end
return normal_status(-2, "验证码不正确") if verifi_code.try(:code) != code.strip
return normal_status(-2, "验证码已失效") if !verifi_code&.effective?
+ return normal_status(-1, "8~16位密码,支持字母数字和符号") unless params[:new_password] =~ CustomRegexp::PASSWORD
user.password, user.password_confirmation = params[:new_password], params[:new_password_confirmation]
ActiveRecord::Base.transaction do
@@ -123,7 +126,7 @@ class AccountsController < ApplicationController
sucess_status
rescue Exception => e
uid_logger_error(e.message)
- tip_exception("密码重置失败")
+ tip_exception(e.message)
end
end
diff --git a/app/controllers/admins/daily_school_statistics_controller.rb b/app/controllers/admins/daily_school_statistics_controller.rb
index eb9c75fbc..f0911f239 100644
--- a/app/controllers/admins/daily_school_statistics_controller.rb
+++ b/app/controllers/admins/daily_school_statistics_controller.rb
@@ -6,6 +6,7 @@ class Admins::DailySchoolStatisticsController < Admins::BaseController
total_count, statistics = Admins::SchoolDailyStatisticService.call(params)
@statistics = paginate statistics, total_count: total_count
+ @params_page = params[:page] || 1
respond_to do |format|
format.html { load_statistic_total }
diff --git a/app/controllers/admins/laboratory_settings_controller.rb b/app/controllers/admins/laboratory_settings_controller.rb
index a65b13f59..283afc175 100644
--- a/app/controllers/admins/laboratory_settings_controller.rb
+++ b/app/controllers/admins/laboratory_settings_controller.rb
@@ -16,7 +16,7 @@ class Admins::LaboratorySettingsController < Admins::BaseController
def form_params
params.permit(:identifier, :name,
- :nav_logo, :login_logo, :tab_logo,
+ :nav_logo, :login_logo, :tab_logo, :oj_banner,
:subject_banner, :course_banner, :competition_banner, :moop_cases_banner,
:footer, navbar: %i[name link hidden])
end
diff --git a/app/controllers/admins/myshixuns_controller.rb b/app/controllers/admins/myshixuns_controller.rb
index f70a64554..adc34e95e 100644
--- a/app/controllers/admins/myshixuns_controller.rb
+++ b/app/controllers/admins/myshixuns_controller.rb
@@ -6,6 +6,7 @@ class Admins::MyshixunsController < Admins::BaseController
myshixuns = Admins::MyshixunQuery.call(params)
@myshixuns = paginate myshixuns.includes(:last_executable_task, :last_task, shixun: :user, user: { user_extension: :school })
+ @params_page = params[:page] || 1
myshixun_ids = @myshixuns.map(&:id)
@finish_game_count = Game.where(myshixun_id: myshixun_ids, status: 2).group(:myshixun_id).count
diff --git a/app/controllers/admins/school_statistics_controller.rb b/app/controllers/admins/school_statistics_controller.rb
index fdd10c70f..5133cc997 100644
--- a/app/controllers/admins/school_statistics_controller.rb
+++ b/app/controllers/admins/school_statistics_controller.rb
@@ -10,6 +10,7 @@ class Admins::SchoolStatisticsController < Admins::BaseController
@grow_summary = service.grow_summary
total_count, statistics = service.call
+ @params_page = params[:page] || 1
@statistics = paginate statistics, total_count: total_count
end
diff --git a/app/controllers/admins/shixun_modify_records_controller.rb b/app/controllers/admins/shixun_modify_records_controller.rb
new file mode 100644
index 000000000..43d9a4a16
--- /dev/null
+++ b/app/controllers/admins/shixun_modify_records_controller.rb
@@ -0,0 +1,9 @@
+class Admins::ShixunModifyRecordsController < Admins::BaseController
+
+ def index
+ records = Admins::ShixunModifyRecordQuery.call(params)
+
+ @records = paginate records.includes(:diff_record_content)
+ end
+
+end
diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb
index bd54018cd..6dbbc077a 100644
--- a/app/controllers/admins/shixun_settings_controller.rb
+++ b/app/controllers/admins/shixun_settings_controller.rb
@@ -15,7 +15,8 @@ class Admins::ShixunSettingsController < Admins::BaseController
hidden: params[:hidden].present? ? params[:hidden] : false,
homepage_show: params[:homepage_show].present? ? params[:homepage_show] : false,
task_pass: params[:task_pass].present? ? params[:task_pass] : false,
- code_hidden: params[:code_hidden].present? ? params[:code_hidden] : false
+ code_hidden: params[:code_hidden].present? ? params[:code_hidden] : false,
+ vip: params[:vip].present? ? params[:vip] : false
}
@shixuns_type_check = MirrorRepository.pluck(:type_name,:id)
@@ -126,6 +127,6 @@ class Admins::ShixunSettingsController < Admins::BaseController
end
def setting_params
- params.permit(:use_scope,:excute_time,:close,:status,:can_copy,:webssh,:hidden,:homepage_show,:task_pass,:code_hidden,:page_no, :id,tag_repertoires:[])
+ params.permit(:use_scope,:excute_time,:close,:status,:can_copy,:webssh,:hidden,:homepage_show,:task_pass,:code_hidden,:vip,:page_no,:id,tag_repertoires:[])
end
end
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 4f82a4c9b..a39789920 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -1299,8 +1299,10 @@ class CoursesController < ApplicationController
begin
@all_members = @course.students
search = params[:search] ? "#{params[:search].strip}" : "" #用户名或学生学号id搜索
- group_id = params[:group_id] #分班的班级id
- @all_members = @all_members.where(course_group_id: group_id.map(&:to_i)) unless group_id.blank?
+ if params[:group_id].present?
+ group_ids = params[:group_id].is_a?(String) ? [params[:group_id].to_i] : params[:group_id].map(&:to_i)
+ @all_members = @all_members.where(course_group_id: group_ids)
+ end
unless search.blank?
@all_members = @all_members.joins(user: [:user_extension]).where('concat(users.lastname, users.firstname) like ? or user_extensions.student_id like ?',"%#{search}%","%#{search}%")
end
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 0299fdf7d..25e0de44a 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -47,26 +47,26 @@ class FilesController < ApplicationController
def bulk_publish
return normal_status(403, "您没有权限进行操作") if current_user.course_identity(@course) >= 5
- tip_exception("请至少选择一个分班") if params[:group_ids].blank? && @course.course_groups.size != 0
+ # tip_exception("请至少选择一个分班") if params[:group_ids].blank? && @course.course_groups.size != 0
attachments = @course.attachments.by_ids(@attachment_ids)
ActiveRecord::Base.transaction do
# 有分班设置时
- if @course.course_group_module? && @course.course_groups_count != 0 && params[:group_ids]
- group_ids = params[:group_ids]&.reject(&:blank?)
- charge_group_ids = @course.charge_group_ids(current_user)
- publish_groups = charge_group_ids & group_ids if group_ids
-
- attachments.each do |atta|
- if atta.published? && !atta.unified_setting || !atta.published?
- create_atta_group_settings atta
- atta.update_all(unified_setting: 0) if atta.unified_setting
- none_publish_settings = atta.attachment_group_settings.where(course_group_id: publish_groups).none_published
- none_publish_settings.update_all(publish_time: Time.now)
- end
- end
- end
+ # if @course.course_group_module? && @course.course_groups_count != 0 && params[:group_ids]
+ # group_ids = params[:group_ids]&.reject(&:blank?)
+ # charge_group_ids = @course.charge_group_ids(current_user)
+ # publish_groups = charge_group_ids & group_ids if group_ids
+ #
+ # attachments.each do |atta|
+ # if atta.published? && !atta.unified_setting || !atta.published?
+ # create_atta_group_settings atta
+ # atta.update_attributes!(unified_setting: 0) if atta.unified_setting
+ # none_publish_settings = atta.attachment_group_settings.where(course_group_id: publish_groups).none_published
+ # none_publish_settings.update_all(publish_time: Time.now)
+ # end
+ # end
+ # end
# 未发布的资源更新状态
attachments.where(is_publish: 0).update_all(is_publish: 1, publish_time: Time.now)
@@ -140,7 +140,7 @@ class FilesController < ApplicationController
def public_with_course_and_project
@attachments = Attachment.publiced.simple_columns
.contains_course_and_project
- .includes(:author => :user_extension)
+ .includes(:container, author: :user_extension)
.by_filename_or_user_name(params[:search])
.ordered(sort: 0, sort_type: 'created_on')
@@ -361,15 +361,16 @@ class FilesController < ApplicationController
def publish_params
tip_exception("缺少发布参数") if params[:delay_publish].blank?
@unified_setting = 1
- if params[:delay_publish].to_i == 1 && @course.course_group_module? && @course.course_groups_count != 0
- tip_exception("分班发布设置不能为空") if params[:group_settings].blank?
- min_publish_time = params[:group_settings].pluck(:publish_time).reject(&:blank?).min
- max_publish_time = params[:group_settings].pluck(:publish_time).reject(&:blank?).max
- tip_exception("分班发布设置不能为空") if min_publish_time.blank?
-
- # 分班设置中的时间一样且包含所有分班 则按统一设置处理,否则是非统一设置
- @unified_setting = 0 unless min_publish_time == max_publish_time && params[:group_settings].pluck(:group_id).flatten.sort == @course.course_groups.pluck(:id).sort
- elsif params[:delay_publish].to_i == 1
+ # if params[:delay_publish].to_i == 1 && @course.course_group_module? && @course.course_groups_count != 0
+ # tip_exception("分班发布设置不能为空") if params[:group_settings].blank?
+ # min_publish_time = params[:group_settings].pluck(:publish_time).reject(&:blank?).min
+ # max_publish_time = params[:group_settings].pluck(:publish_time).reject(&:blank?).max
+ # tip_exception("分班发布设置不能为空") if min_publish_time.blank?
+ #
+ # # 分班设置中的时间一样且包含所有分班 则按统一设置处理,否则是非统一设置
+ # @unified_setting = 0 unless min_publish_time == max_publish_time && params[:group_settings].pluck(:group_id).flatten.sort == @course.course_groups.pluck(:id).sort
+ # els
+ if params[:delay_publish].to_i == 1
tip_exception("缺少延期发布的时间参数") if params[:publish_time].blank?
min_publish_time = params[:publish_time]
end
diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb
index 37102a166..b7ec6fb8e 100644
--- a/app/controllers/hack_user_lastest_codes_controller.rb
+++ b/app/controllers/hack_user_lastest_codes_controller.rb
@@ -1,13 +1,14 @@
class HackUserLastestCodesController < ApplicationController
before_action :require_login, except: [:listen_result]
- before_action :find_my_hack, only: [:show, :code_debug, :code_submit, :update_code,
+ before_action :find_my_hack, only: [:show, :code_debug, :code_submit, :update_code, :sync_code,
:listen_result, :result, :submit_records, :restore_initial_code]
before_action :update_user_hack_status, only: [:code_debug, :code_submit]
- before_action :require_auth_identity, only: [:update_code, :restore_initial_code]
+ before_action :require_auth_identity, only: [:update_code, :restore_initial_code, :sync_code]
before_action :require_manager_identity, only: [:update_code]
def show
@my_hack.update_attribute(:submit_status, 0) if @my_hack.submit_status == 1
+ @modify = @my_hack.modify_time.to_i < @hack.hack_codes.first.modify_time.to_i
end
def update_code
@@ -15,10 +16,14 @@ class HackUserLastestCodesController < ApplicationController
render_ok
end
- # 回复初始代码
+ # 恢复初始代码
def restore_initial_code
@my_hack.update_attribute(:code, @hack.code)
- render_ok
+ end
+
+ # 同步代码
+ def sync_code
+ @my_hack.update_attributes(code: @hack.code, modify_time: @hack.modify_time)
end
# 调试代码
@@ -55,12 +60,15 @@ class HackUserLastestCodesController < ApplicationController
end
# 提交记录
- def submit_records;end
+ def submit_records
+ @records = @my_hack.hack_user_codes.created_order
+ end
# 提交记录详情
def record_detail
@hack_user = HackUserCode.find params[:id]
+ @my_hack = @hack_user.hack_user_lastest_code
end
# 接收中间件返回结果接口
diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb
index 993cba4e6..c9e9097f8 100644
--- a/app/controllers/hacks_controller.rb
+++ b/app/controllers/hacks_controller.rb
@@ -1,7 +1,7 @@
class HacksController < ApplicationController
before_action :require_login, except: [:index]
before_action :find_hack, only: [:edit, :update, :publish, :start, :update_set, :delete_set]
- before_action :require_teacher_identity, only: [:create, :update_set]
+ before_action :require_teacher_identity, only: [:create, :update_set, :edit, :update]
before_action :require_auth_identity, only: [:update, :edit, :publish, :update_set, :delete_set]
@@ -15,7 +15,7 @@ class HacksController < ApplicationController
user_hack.identifier
else
user_identifier = generate_identifier HackUserLastestCode, 12
- user_code = {user_id: current_user.id, code: @hack.code,
+ user_code = {user_id: current_user.id, code: @hack.code, modify_time: Time.now,
identifier: user_identifier, language: @hack.language}
@hack.hack_user_lastest_codes.create!(user_code)
user_identifier
@@ -47,10 +47,10 @@ class HacksController < ApplicationController
hack.identifier = generate_identifier Hack, 8
hack.save!
# 创建测试集与代码
- logger.info("hack_sets_params:#{hack_sets_params}")
- logger.info("hack_code_params:#{hack_code_params}")
hack.hack_sets.create!(hack_sets_params)
- hack.hack_codes.create!(hack_code_params)
+ hack_codes = hack.hack_codes.new(hack_code_params)
+ hack_codes.modify_time = Time.now
+ hack_codes.save!
end
render_ok({identifier: hack.identifier})
rescue Exception => e
@@ -69,7 +69,8 @@ class HacksController < ApplicationController
# 新建
@hack.hack_sets.create!(hack_sets_params)
# 更新代码
- @hack.hack_codes.create!(hack_code_params)
+ code_params = params[:hack_codes][:code] != @hack.code ? hack_code_params.merge(modify_time: Time.now) : hack_code_params
+ @hack.hack_codes.first.update_attributes!(code_params)
end
render_ok
rescue Exception => e
@@ -109,6 +110,8 @@ class HacksController < ApplicationController
def edit;end
+ def new;end
+
private
# 实名认证老师,管理员与运营人员权限
def require_teacher_identity
@@ -199,7 +202,7 @@ class HacksController < ApplicationController
end
def start_hack_auth
- return true if @hack == 1
+ return true if @hack.status == 1
require_auth_identity
end
diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb
index 1c6b606e5..e11fefea1 100644
--- a/app/controllers/homework_commons_controller.rb
+++ b/app/controllers/homework_commons_controller.rb
@@ -453,7 +453,9 @@ class HomeworkCommonsController < ApplicationController
# 课堂结束后不能再更新
unless @course.is_end
+ UpdateHomeworkPublishSettingService.call(@homework, publish_params)
# 作业未发布时,unified_setting参数不能为空
+=begin
if @homework.publish_time.nil? || @homework.publish_time > Time.now
tip_exception("缺少统一设置的参数") if params[:unified_setting].nil?
if params[:unified_setting] || @course.course_groups_count == 0
@@ -549,6 +551,7 @@ class HomeworkCommonsController < ApplicationController
@homework.end_time = @homework.max_group_end_time
end
end
+=end
# 补交设置
tip_exception("缺少allow_late参数") if params[:allow_late].nil?
@@ -582,8 +585,8 @@ class HomeworkCommonsController < ApplicationController
tip_exception("缺少answer_open_evaluation参数") if params[:answer_open_evaluation].nil?
tip_exception("缺少work_efficiency参数") if params[:work_efficiency].nil?
tip_exception("缺少eff_score参数") if params[:work_efficiency] && params[:eff_score].blank?
- tip_exception("效率分不能小于等于0") if params[:eff_score] && params[:eff_score].to_f <= 0
- tip_exception("效率分不能大于总分值") if params[:eff_score] && params[:eff_score].to_f.round(2) > params[:total_score].to_f.round(2)
+ tip_exception("效率分不能小于等于0") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f <= 0
+ tip_exception("效率分不能大于总分值") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f.round(2) > params[:total_score].to_f.round(2)
tip_exception("缺少shixun_evaluation参数") if params[:shixun_evaluation].blank?
tip_exception("缺少challenge_settings参数") if params[:challenge_settings].blank?
# tip_exception("缺少challenge_id参数") if params[:challenge_settings][:challenge_id].blank?
@@ -635,7 +638,7 @@ class HomeworkCommonsController < ApplicationController
@homework.save!
if score_change && @homework.end_or_late_none_group
- UpdateShixunWorkScoreJob.perform_now(@homework.id)
+ UpdateShixunWorkScoreJob.perform_later(@homework.id)
elsif update_eff_score && (@homework.end_or_late_none_group || @homework.max_efficiency > 0)
# 更新所有学生的效率分(作业允许补交且补交已截止 或者 作业不允许补交且提交已截止 或者作业已计算过效率分)
HomeworksService.new.update_student_eff_score HomeworkCommon.find_by(id: @homework.id)
@@ -826,12 +829,16 @@ class HomeworkCommonsController < ApplicationController
end
end
-
- HomeworkCommonPushNotifyJob.perform_later(@homework.id, publish_group_ids) if send_tiding
normal_status(0, "更新成功")
else
tip_exception("课堂已结束不能再更新")
end
+ # rescue ActiveRecord::RecordInvalid
+ # render_error("保存失败")
+ # rescue ApplicationService::Error => ex
+ # uid_logger(ex.message)
+ # render_error(ex.message)
+ # raise ActiveRecord::Rollback
rescue Exception => e
uid_logger(e.backtrace)
tip_exception(e.message)
@@ -1101,7 +1108,7 @@ class HomeworkCommonsController < ApplicationController
else
homework.unified_setting = false
# 创建作业分班设置:homework_group_setting
- create_homework_group_settings(homework)
+ homework.create_homework_group_settings
# 选中的分班设置的发布时间改为当前时间,截止时间改为传的截止时间参数
if params[:detail]
@@ -1137,7 +1144,7 @@ class HomeworkCommonsController < ApplicationController
# 发消息
HomeworkCommonPushNotifyJob.perform_later(homework.id, tiding_group_ids)
else
- create_homework_group_settings(homework)
+ homework.create_homework_group_settings
none_publish_settings = homework.homework_group_settings.where(course_group_id: publish_groups).none_published
if params[:detail]
@@ -1211,7 +1218,7 @@ class HomeworkCommonsController < ApplicationController
# 分组设置
if !params[:group_ids].blank?
# 确保之前是统一设置或者有新创建的分班的数据一致性
- create_homework_group_settings(homework)
+ homework.create_homework_group_settings
homework.unified_setting = false if homework.unified_setting && end_groups.length != @course.course_groups_count
@@ -1582,15 +1589,6 @@ class HomeworkCommonsController < ApplicationController
end
- def create_homework_group_settings homework
- if homework.homework_group_settings.size != @course.course_groups.size
- @course.course_groups.where.not(id: homework.homework_group_settings.pluck(:course_group_id)).each do |group|
- homework.homework_group_settings << HomeworkGroupSetting.new(course_group_id: group.id, course_id: @course.id,
- publish_time: homework.publish_time, end_time: homework.end_time)
- end
- end
- end
-
def get_new_code_reviews_result homework
if homework.code_reviews_new_results?
# 获取最新的查询id
@@ -1653,4 +1651,8 @@ class HomeworkCommonsController < ApplicationController
homework_bank
end
+ def publish_params
+ params.permit(:unified_setting, :publish_time, :end_time, group_settings: [:publish_time, :end_time, group_id: []])
+ end
+
end
diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb
index 068a0dafd..0c442a613 100644
--- a/app/controllers/polls_controller.rb
+++ b/app/controllers/polls_controller.rb
@@ -1409,23 +1409,29 @@ class PollsController < ApplicationController
poll_questions.each do |q|
user_poll_votes = u_user.poll_votes.find_current_vote("poll_question_id",q.id)
if user_poll_votes.present?
- user_poll_answer_ids = user_poll_votes.pluck(:poll_answer_id).reject(&:blank?)
- user_poll_vote_texts = user_poll_votes.pluck(:vote_text).reject(&:blank?)
- if user_poll_answer_ids.count > 0
- answer_content = q.poll_answers.find_answer_by_custom("id",user_poll_answer_ids)
- if user_poll_answer_ids.count >1
- u_answer = answer_content.pluck(:answer_text).join(";")
+ if q.question_type < 3
+ user_poll_answer_ids = user_poll_votes.pluck(:poll_answer_id).reject(&:blank?)
+ if user_poll_answer_ids.count > 0
+ answer_content = q.poll_answers.find_answer_by_custom("id",user_poll_answer_ids)
+ if user_poll_answer_ids.count >1
+ u_answer = answer_content.pluck(:answer_text).join(";")
+ else
+ u_answer = answer_content.first&.answer_text
+ end
else
- u_answer = answer_content.first.answer_text
+ u_answer = "--"
end
- elsif user_poll_vote_texts.count > 0
- if user_poll_vote_texts.count > 1
- u_answer = user_poll_vote_texts.join(";")
+ else
+ user_poll_vote_texts = user_poll_votes.pluck(:vote_text).reject(&:blank?)
+ if user_poll_vote_texts.count > 0
+ if user_poll_vote_texts.count > 1
+ u_answer = user_poll_vote_texts.join(";")
+ else
+ u_answer = user_poll_vote_texts.first
+ end
else
- u_answer = user_poll_vote_texts.first
+ u_answer = "--"
end
- else
- u_answer = "--"
end
else
u_answer = "--"
diff --git a/app/controllers/users/authentication_applies_controller.rb b/app/controllers/users/authentication_applies_controller.rb
index 3c43be553..bf5aa0d40 100644
--- a/app/controllers/users/authentication_applies_controller.rb
+++ b/app/controllers/users/authentication_applies_controller.rb
@@ -1,5 +1,6 @@
class Users::AuthenticationAppliesController < Users::BaseAccountController
before_action :private_user_resources!
+ before_action :check_account, only: [:create]
def create
Users::ApplyAuthenticationService.call(observed_user, create_params)
diff --git a/app/controllers/users/professional_auth_applies_controller.rb b/app/controllers/users/professional_auth_applies_controller.rb
index d1ee70953..9fc8e73db 100644
--- a/app/controllers/users/professional_auth_applies_controller.rb
+++ b/app/controllers/users/professional_auth_applies_controller.rb
@@ -1,5 +1,6 @@
class Users::ProfessionalAuthAppliesController < Users::BaseAccountController
before_action :private_user_resources!
+ before_action :check_account, only: [:create]
def create
Users::ApplyProfessionalAuthService.call(observed_user, create_params)
diff --git a/app/controllers/weapps/courses_controller.rb b/app/controllers/weapps/courses_controller.rb
index 1ccefcbe2..a30fdfa4c 100644
--- a/app/controllers/weapps/courses_controller.rb
+++ b/app/controllers/weapps/courses_controller.rb
@@ -6,7 +6,7 @@ class Weapps::CoursesController < Weapps::BaseController
before_action :teacher_or_admin_allowed, only: [:change_member_roles, :delete_course_teachers]
def create
- return render_error("只有老师身份才能创建课堂") unless current_user.is_teacher?
+ # return render_error("只有老师身份才能创建课堂") unless current_user.is_teacher?
course = Course.new(tea_id: current_user.id)
Weapps::CreateCourseService.call(course, course_params)
render_ok
@@ -107,7 +107,7 @@ class Weapps::CoursesController < Weapps::BaseController
# 批量修改角色
def change_member_roles
@course = current_course
- tip_exception("请至少选择一个角色") if params[:roles].blank?
+ tip_exception("请至少选择一个角色") if params[:roles].reject(&:blank?).blank?
tip_exception("不能具有老师、助教两种角色") if params[:roles].include?("PROFESSOR") && params[:roles].include?("ASSISTANT_PROFESSOR")
params[:user_ids].each do |user_id|
@@ -150,13 +150,13 @@ class Weapps::CoursesController < Weapps::BaseController
new_student.is_active = 0 if correspond_teacher_exist
new_student.save!
- CourseAddStudentCreateWorksJob.perform_later(@course.id, user_id)
+ CourseAddStudentCreateWorksJob.perform_later(@course.id, [user_id])
# StudentJoinCourseNotifyJob.perform_later(current_user.id, course.id)
elsif !params[:roles].include?("STUDENT") && student_member.present?
# 删除学生身份时激活老师身份
teacher_member.update_attributes!(is_active: 1) if student_member.is_active && teacher_member.present?
student_member.destroy!
- CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, user_id)
+ CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, [user_id])
# CourseDeleteStudentNotifyJob.perform_later(@course.id, [params[:user_id]], current_user.id)
elsif params[:roles].include?("STUDENT") && student_member.present? && !params[:roles].include?("PROFESSOR") && !params[:roles].include?("ASSISTANT_PROFESSOR")
# 学生身份存在且学生没有教师身份时更新is_active
diff --git a/app/controllers/weapps/homework_commons_controller.rb b/app/controllers/weapps/homework_commons_controller.rb
new file mode 100644
index 000000000..ebadd00b0
--- /dev/null
+++ b/app/controllers/weapps/homework_commons_controller.rb
@@ -0,0 +1,38 @@
+class Weapps::HomeworkCommonsController < Weapps::BaseController
+ before_action :require_login
+ before_action :find_homework, :user_course_identity
+ before_action :teacher_allowed
+
+ def update_settings
+ begin
+ # 课堂结束后不能再更新
+ unless @course.is_end
+ UpdateHomeworkPublishSettingService.call(@homework, publish_params)
+ render_ok
+ else
+ tip_exception("课堂已结束不能再更新")
+ end
+ rescue Exception => e
+ uid_logger(e.backtrace)
+ tip_exception(e.message)
+ raise ActiveRecord::Rollback
+ end
+ end
+
+ private
+
+ def teacher_allowed
+ return render_forbidden unless @user_course_identity < Course::STUDENT
+ end
+
+ def find_homework
+ @homework = HomeworkCommon.find_by!(id: params[:id])
+ @course = @homework.course
+ @homework_detail_manual = @homework.homework_detail_manual
+ end
+
+ def publish_params
+ params.permit(:unified_setting, :publish_time, :end_time, group_settings: [:publish_time, :end_time, group_id: []])
+ end
+
+end
\ No newline at end of file
diff --git a/app/forms/users/update_password_form.rb b/app/forms/users/update_password_form.rb
index 4da341839..db674384c 100644
--- a/app/forms/users/update_password_form.rb
+++ b/app/forms/users/update_password_form.rb
@@ -3,5 +3,5 @@ class Users::UpdatePasswordForm
attr_accessor :password, :old_password
- validates :password, presence: true
+ validates :password, presence: true, length: { minimum: 8, maximum: 16 }, format: { with: CustomRegexp::PASSWORD, message: "8~16位密码,支持字母数字和符号" }
end
\ No newline at end of file
diff --git a/app/libs/custom_regexp.rb b/app/libs/custom_regexp.rb
index 2a2a99384..2980f2ed2 100644
--- a/app/libs/custom_regexp.rb
+++ b/app/libs/custom_regexp.rb
@@ -3,4 +3,5 @@ module CustomRegexp
EMAIL = /\A[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+\z/
LASTNAME = /\A[a-zA-Z0-9\u4e00-\u9fa5]+\z/
NICKNAME = /\A[\u4e00-\u9fa5_a-zA-Z0-9]+\z/
+ PASSWORD = /\A[a-z_A-Z0-9\-\.!@#\$%\\\^&\*\)\(\+=\{\}\[\]\/",'_<>~\·`\?:;|]{8,16}\z/
end
\ No newline at end of file
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index a918f4e0a..f18d9cd2a 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -21,7 +21,7 @@ class Attachment < ApplicationRecord
scope :contains_only_project, -> { where(container_type: 'Project') }
scope :contains_course_and_project, -> { contains_only_course.or(contains_only_project) }
scope :mine, -> (author_id) { where(author_id: author_id) }
- scope :simple_columns, -> { select(:id, :filename, :filesize, :created_on, :cloud_url, :author_id, :content_type) }
+ scope :simple_columns, -> { select(:id, :filename, :filesize, :created_on, :cloud_url, :author_id, :content_type, :container_type, :container_id) }
scope :search_by_container, -> (ids) {where(container_id: ids)}
scope :unified_setting, -> {where("unified_setting = ? ", 1)}
@@ -35,7 +35,7 @@ class Attachment < ApplicationRecord
def title
title = filename
- if container.is_a?(StudentWork) && author_id != User.current.id
+ if container && container.is_a?(StudentWork) && author_id != User.current.id
course = container&.homework_common&.course
unless User.current.teacher_of_course?(course)
title = "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{DCODES.sample(8).join}" + File.extname(filename)
diff --git a/app/models/hack.rb b/app/models/hack.rb
index 80724d3d4..506cd4942 100644
--- a/app/models/hack.rb
+++ b/app/models/hack.rb
@@ -3,6 +3,8 @@ class Hack < ApplicationRecord
# diffcult: 难度 1:简单;2:中等; 3:困难
# 编程题
validates_length_of :name, maximum: 60
+ validates :description, presence: { message: "描述不能为空" }
+ validates :name, presence: { message: "名称不能为空" }
# 测试集
has_many :hack_sets, ->{order("position asc")}, :dependent => :destroy
# 代码
@@ -39,4 +41,9 @@ class Hack < ApplicationRecord
hack_sets.first&.input
end
+ # 管理员
+ def manager?(user)
+ user_id == user.id || user.admin_or_business?
+ end
+
end
diff --git a/app/models/hack_set.rb b/app/models/hack_set.rb
index 5dab862b5..6afe05663 100644
--- a/app/models/hack_set.rb
+++ b/app/models/hack_set.rb
@@ -1,6 +1,7 @@
class HackSet < ApplicationRecord
- validates :input, presence: { message: "测试集输入不能为空" }
+ #validates :input, presence: { message: "测试集输入不能为空" }
validates :output, presence: { message: "测试集输出不能为空" }
+ validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同"
# 编程题测试集
belongs_to :hack
end
diff --git a/app/models/hack_user_code.rb b/app/models/hack_user_code.rb
index d9d2dff77..eee394e39 100644
--- a/app/models/hack_user_code.rb
+++ b/app/models/hack_user_code.rb
@@ -1,4 +1,7 @@
class HackUserCode < ApplicationRecord
# 用户编程题的信息
belongs_to :hack
+ belongs_to :hack_user_lastest_code
+
+ scope :created_order, ->{ order("created_at desc")}
end
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index def3b6b0d..d37650c37 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -285,6 +285,15 @@ class HomeworkCommon < ApplicationRecord
homework_challenge_settings.find_by(challenge_id: challenge_id)&.score.to_f
end
+ def create_homework_group_settings
+ if homework_group_settings.size != course.course_groups.size
+ course.course_groups.where.not(id: homework_group_settings.pluck(:course_group_id)).each do |group|
+ homework_group_settings << HomeworkGroupSetting.new(course_group_id: group.id, course_id: course.id,
+ publish_time: publish_time, end_time: end_time)
+ end
+ end
+ end
+
def update_homework_work_score
if unified_setting
works = student_works
diff --git a/app/models/laboratory_setting.rb b/app/models/laboratory_setting.rb
index 416020836..4eacaf460 100644
--- a/app/models/laboratory_setting.rb
+++ b/app/models/laboratory_setting.rb
@@ -42,6 +42,10 @@ class LaboratorySetting < ApplicationRecord
image_url('_moop_cases_banner')
end
+ def oj_banner_url
+ image_url('_oj_banner')
+ end
+
def default_navbar
self.class.default_config[:navbar]
end
diff --git a/app/queries/admins/shixun_modify_record_query.rb b/app/queries/admins/shixun_modify_record_query.rb
new file mode 100644
index 000000000..227e2f4c2
--- /dev/null
+++ b/app/queries/admins/shixun_modify_record_query.rb
@@ -0,0 +1,33 @@
+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
diff --git a/app/queries/admins/shixun_settings_query.rb b/app/queries/admins/shixun_settings_query.rb
index ab871b58e..377e7bf60 100644
--- a/app/queries/admins/shixun_settings_query.rb
+++ b/app/queries/admins/shixun_settings_query.rb
@@ -51,6 +51,7 @@ class Admins::ShixunSettingsQuery < ApplicationQuery
all_shixuns = all_shixuns.where(homepage_show: params[:homepage_show]) if params[:homepage_show]
all_shixuns = all_shixuns.where(task_pass: params[:task_pass]) if params[:task_pass]
all_shixuns = all_shixuns.where(code_hidden: params[:code_hidden]) if params[:code_hidden]
+ all_shixuns = all_shixuns.where(vip: params[:vip]) if params[:vip]
custom_sort(all_shixuns, params[:sort_by], params[:sort_direction])
end
diff --git a/app/services/admins/check_shixun_mirrors_service.rb b/app/services/admins/check_shixun_mirrors_service.rb
index 8334df485..4aa0af4cf 100644
--- a/app/services/admins/check_shixun_mirrors_service.rb
+++ b/app/services/admins/check_shixun_mirrors_service.rb
@@ -75,13 +75,12 @@ class Admins::CheckShixunMirrorsService < ApplicationService
def bridge_images
@_bridge_images ||= begin
- url = EduSetting.get('cloud_bridge')
+ url = "#{EduSetting.get('cloud_bridge')}/bridge/docker/images"
res = Faraday.get(url)
- res_body = JSON.parse(res.body)
+ res = JSON.parse(res.body)
+ raise Error, '拉取镜像信息异常' if res && res['code'] != 0
- raise Error, '拉取镜像信息异常' if res_body && res_body['code'].to_i != 0
-
- res_body
+ res
rescue => e
Rails.logger.error("get response failed ! #{e.message}")
raise Error, '实训云平台繁忙(繁忙等级:84)'
diff --git a/app/services/admins/save_laboratory_setting_service.rb b/app/services/admins/save_laboratory_setting_service.rb
index b35323608..c29e374bd 100644
--- a/app/services/admins/save_laboratory_setting_service.rb
+++ b/app/services/admins/save_laboratory_setting_service.rb
@@ -43,6 +43,7 @@ class Admins::SaveLaboratorySettingService < ApplicationService
save_image_file(params[:course_banner], '_course_banner')
save_image_file(params[:competition_banner], '_competition_banner')
save_image_file(params[:moop_cases_banner], '_moop_cases_banner')
+ save_image_file(params[:oj_banner], '_oj_banner')
end
def save_image_file(file, type)
diff --git a/app/services/create_diff_record_service.rb b/app/services/create_diff_record_service.rb
index 8365404e2..3943af1ae 100644
--- a/app/services/create_diff_record_service.rb
+++ b/app/services/create_diff_record_service.rb
@@ -25,21 +25,23 @@ class CreateDiffRecordService < ApplicationService
index = 0
fragment_size = 1
Diffy::Diff.new(before, after).each do |line|
- unless line =~ /^[\+-]/
- if arr.empty? && index < fragment_size
- content += line
- index += 1
- else
- index = 0
- arr << line
- arr.shift if arr.size > fragment_size
+ unless line.include?("\\ 文件尾没有 newline 字符")
+ unless line =~ /^[\+-]/
+ if arr.empty? && index < fragment_size
+ content += line
+ index += 1
+ else
+ index = 0
+ arr << line
+ arr.shift if arr.size > fragment_size
+ end
+ next
end
- next
- end
- content += arr.join('') if arr.present?
- content += line
- arr.clear
+ content += arr.join('') if arr.present?
+ content += line
+ arr.clear
+ end
end
content
end
diff --git a/app/services/update_homework_publish_setting_service.rb b/app/services/update_homework_publish_setting_service.rb
new file mode 100644
index 000000000..69a68b613
--- /dev/null
+++ b/app/services/update_homework_publish_setting_service.rb
@@ -0,0 +1,116 @@
+class UpdateHomeworkPublishSettingService < ApplicationService
+ attr_reader :homework, :params
+
+ def initialize(homework, params)
+ @params = params
+ @homework = homework
+ end
+
+ def call
+ puts params
+ course = homework.course
+ # 作业未发布时,unified_setting参数不能为空
+ if homework.publish_time.nil? || homework.publish_time > Time.now
+ tip_exception("缺少统一设置的参数") if params[:unified_setting].nil?
+ if params[:unified_setting] || course.course_groups_count == 0
+ tip_exception("发布时间不能为空") if params[:publish_time].blank?
+ tip_exception("截止时间不能为空") if params[:end_time].blank?
+ tip_exception("发布时间不能早于当前时间") if params[:publish_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S")
+ tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S")
+ tip_exception("截止时间不能早于发布时间") if params[:publish_time] > params[:end_time]
+ tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
+ course.end_date.present? && params[:end_time] > course.end_date.end_of_day
+
+ homework.unified_setting = 1
+ homework.homework_group_settings.destroy_all
+ homework.publish_time = params[:publish_time]
+ # 截止时间为空时取发布时间后一个月
+ homework.end_time = params[:end_time]
+
+ else
+ tip_exception("分班发布设置不能为空") if params[:group_settings].blank?
+ # 创建作业的分班设置
+ homework.create_homework_group_settings
+
+ setting_group_ids = []
+
+ params[:group_settings].each do |setting|
+ tip_exception("分班id不能为空") if setting[:group_id].length == 0
+ tip_exception("发布时间不能为空") if setting[:publish_time].blank?
+ tip_exception("截止时间不能为空") if setting[:end_time].blank?
+ tip_exception("发布时间不能早于当前时间") if setting[:publish_time].to_time <= Time.now
+ tip_exception("截止时间不能早于当前时间") if setting[:end_time].to_time <= Time.now
+ tip_exception("截止时间不能早于发布时间") if setting[:publish_time].to_time > setting[:end_time].to_time
+ tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
+ course.end_date.present? && setting[:end_time] > course.end_date.end_of_day
+
+
+ publish_time = setting[:publish_time] == "" ? Time.now : setting[:publish_time]
+ # 截止时间为空时取发布时间后一个月
+ end_time = setting[:end_time]
+ HomeworkGroupSetting.where(homework_common_id: homework.id, course_group_id: setting[:group_id]).
+ update_all(publish_time: publish_time, end_time: end_time)
+ setting_group_ids << setting[:group_id]
+ end
+
+ # 未设置的分班:发布时间和截止时间都为nil
+ HomeworkGroupSetting.where.not(course_group_id: setting_group_ids).where(homework_common_id: homework.id).
+ update_all(publish_time: nil, end_time: nil)
+
+ # 记录已发布需要发消息的分班
+ publish_group_ids = HomeworkGroupSetting.where(homework_common_id: homework.id).group_published.pluck(:course_group_id)
+
+ homework.unified_setting = 0
+ homework.publish_time = homework.min_group_publish_time
+ homework.end_time = homework.max_group_end_time
+ end
+
+ # 如果作业立即发布则更新状态、发消息
+ if homework.publish_time <= Time.now and homework_detail_manual.comment_status == 0
+ homework_detail_manual.comment_status = 1
+ send_tiding = true
+ end
+
+ # 作业在"提交中"状态时
+ else
+ if homework.end_time > Time.now && homework.unified_setting
+ tip_exception("截止时间不能为空") if params[:end_time].blank?
+ tip_exception("截止时间不能早于当前时间") if params[:end_time].to_time <= Time.now
+ tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
+ course.end_date.present? && params[:end_time].to_time > course.end_date.end_of_day
+
+ homework.end_time = params[:end_time]
+
+ elsif !homework.unified_setting
+ homework.create_homework_group_settings
+ tip_exception("分班发布设置不能为空") if params[:group_settings].reject(&:blank?).blank?
+ params[:group_settings].each do |setting|
+ group_settings = HomeworkGroupSetting.where(homework_common_id: homework.id, course_group_id: setting[:group_id])
+
+ tip_exception("分班id不能为空") if setting[:group_id].length == 0
+ tip_exception("发布时间不能为空") if setting[:publish_time].blank?
+ tip_exception("截止时间不能为空") if setting[:end_time].blank?
+ # 如果该发布规则 没有已发布的分班则需判断发布时间
+ tip_exception("发布时间不能早于等于当前时间") if setting[:publish_time].to_time <= Time.now && group_settings.group_published.count == 0
+
+ tip_exception("截止时间不能早于等于当前时间") if setting[:end_time].to_time <= Time.now && group_settings.none_end.count > 0
+ tip_exception("截止时间不能早于发布时间") if setting[:publish_time].to_time > setting[:end_time].to_time
+ tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if
+ course.end_date.present? && setting[:end_time].to_time > course.end_date.end_of_day
+
+ group_settings.none_published.update_all(publish_time: setting[:publish_time])
+ group_settings.none_end.update_all(end_time: setting[:end_time])
+ end
+
+ homework.end_time = homework.max_group_end_time
+ end
+ end
+ homework.save!
+ HomeworkCommonPushNotifyJob.perform_later(homework.id, publish_group_ids) if send_tiding
+ end
+
+ private
+ def tip_exception(status = -1, message)
+ raise Educoder::TipException.new(status, message)
+ end
+end
\ No newline at end of file
diff --git a/app/views/admins/courses/shared/_list.html.erb b/app/views/admins/courses/shared/_list.html.erb
index 633616462..4105c8153 100644
--- a/app/views/admins/courses/shared/_list.html.erb
+++ b/app/views/admins/courses/shared/_list.html.erb
@@ -1,30 +1,31 @@
+ 序号 |
ID |
课堂名称 |
- 成员 |
+ 成员 |
资源 |
普通作业 |
分组作业 |
实训作业 |
试卷 |
- 评测次数 |
+ 评测次数 |
私有 |
状态 |
单位 |
创建者 |
<%= sort_tag('创建时间', name: 'created_at', path: admins_courses_path) %> |
首页 |
- 邮件通知 |
- 操作 |
+ 邮件通知 |
+ 操作 |
<% if courses.present? %>
- <% courses.each do |course| %>
+ <% courses.each_with_index do |course, index| %>
- <%= render 'admins/courses/shared/td', course: course %>
+ <%= render partial: 'admins/courses/shared/td', locals: {course: course, no: index} %>
<% end %>
<% else %>
diff --git a/app/views/admins/courses/shared/_td.html.erb b/app/views/admins/courses/shared/_td.html.erb
index 1d2da2a33..51cc4b199 100644
--- a/app/views/admins/courses/shared/_td.html.erb
+++ b/app/views/admins/courses/shared/_td.html.erb
@@ -1,3 +1,4 @@
+<%= list_index_no((params[:page] || 1).to_i, no) %> |
<%= course.id %> |
<%= link_to(course.name, "/courses/#{course.id}", target: '_blank') %>
diff --git a/app/views/admins/courses/update.js.erb b/app/views/admins/courses/update.js.erb
index 1278a2e1f..983ac22f0 100644
--- a/app/views/admins/courses/update.js.erb
+++ b/app/views/admins/courses/update.js.erb
@@ -1 +1,3 @@
-$("#course-item-<%= @course.id %>").html("<%= j render partial: "admins/courses/shared/td",locals: {course: @course} %>")
\ No newline at end of file
+var index = $("#course-item-<%= @course.id %>").children(":first").html();
+$("#course-item-<%= @course.id %>").html("<%= j render partial: "admins/courses/shared/td",locals: {course: @course, no: 1} %>");
+$("#course-item-<%= @course.id %>").children(":first").html(index);
\ No newline at end of file
diff --git a/app/views/admins/customers/shared/_list.html.erb b/app/views/admins/customers/shared/_list.html.erb
index 0ba5638cb..6f84db4e5 100644
--- a/app/views/admins/customers/shared/_list.html.erb
+++ b/app/views/admins/customers/shared/_list.html.erb
@@ -1,15 +1,17 @@
- 客户名称 |
+ 序号 |
+ 客户名称 |
<%= sort_tag('添加时间', name: 'created_at', path: admins_partner_customers_path(current_partner)) %> |
操作 |
<% if customers.present? %>
- <% customers.each do |customer| %>
+ <% customers.each_with_index do |customer, index| %>
+ <%= list_index_no((params[:page] || 1).to_i, index) %> |
<%= customer.school&.name %> |
<%= customer.created_at&.strftime('%Y-%m-%d %H:%M') %> |
diff --git a/app/views/admins/daily_school_statistics/shared/_list.html.erb b/app/views/admins/daily_school_statistics/shared/_list.html.erb
index 611acdd2a..6982891ee 100644
--- a/app/views/admins/daily_school_statistics/shared/_list.html.erb
+++ b/app/views/admins/daily_school_statistics/shared/_list.html.erb
@@ -1,8 +1,8 @@
+ 序号 |
单位名称 |
-
<%= sort_tag('教师总数', name: 'teacher_count', path: admins_daily_school_statistics_path) %> |
<%= sort_tag('学生总数', name: 'student_count', path: admins_daily_school_statistics_path) %> |
<%= sort_tag('课堂总数', name: 'course_count', path: admins_daily_school_statistics_path) %> |
@@ -16,13 +16,14 @@
<%= sort_tag('实训作业总数', name: 'homework_count', path: admins_daily_school_statistics_path) %> |
<%= sort_tag('其它作业总数', name: 'other_homework_count', path: admins_daily_school_statistics_path) %> |
- <%= sort_tag('动态时间', name: 'nearly_course_time', path: admins_daily_school_statistics_path) %> |
+ <%= sort_tag('动态时间', name: 'nearly_course_time', path: admins_daily_school_statistics_path) %> |
<% if statistics.present? %>
- <% statistics.each do |statistic| %>
+ <% statistics.each_with_index do |statistic, index| %>
+ <%= list_index_no(@params_page.to_i, index) %> |
<%= link_to statistic[:name], "/colleges/#{statistic[:id]}/statistics",
target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %>
diff --git a/app/views/admins/department_applies/shared/_list.html.erb b/app/views/admins/department_applies/shared/_list.html.erb
index 0a1d803be..87d5ab66f 100644
--- a/app/views/admins/department_applies/shared/_list.html.erb
+++ b/app/views/admins/department_applies/shared/_list.html.erb
@@ -1,18 +1,20 @@
+ 序号 |
ID |
部门名称 |
单位名称 |
- 创建者 |
+ 创建者 |
<%= sort_tag('创建于', name: 'created_at', path: admins_department_applies_path) %> |
操作 |
<% if applies.present? %>
- <% applies.each do |apply| %>
+ <% applies.each_with_index do |apply, index| %>
+ <%= list_index_no((params[:page] || 1).to_i, index) %> |
<%= apply.id %> |
<%= apply.name %> |
<%= apply.school.try(:name) %> |
diff --git a/app/views/admins/department_members/create.js.erb b/app/views/admins/department_members/create.js.erb
index 4355c7432..6bf0a6ac3 100644
--- a/app/views/admins/department_members/create.js.erb
+++ b/app/views/admins/department_members/create.js.erb
@@ -1,4 +1,6 @@
$('.modal.admin-add-department-member-modal').modal('hide');
$.notify({ message: '操作成功' });
-$('.department-list-table .department-item-<%= current_department.id %>').html("<%= j(render partial: 'admins/departments/shared/department_item', locals: { department: current_department }) %>")
\ No newline at end of file
+var index = $(".department-item-<%= current_department.id %>").children(":first").html();
+$('.department-list-table .department-item-<%= current_department.id %>').html("<%= j(render partial: 'admins/departments/shared/department_item', locals: { department: current_department, index: 1 }) %>");
+$(".department-item-<%= current_department.id %>").children(":first").html(index);
\ No newline at end of file
diff --git a/app/views/admins/departments/shared/_department_item.html.erb b/app/views/admins/departments/shared/_department_item.html.erb
index 64b4ee70b..62f3a81ac 100644
--- a/app/views/admins/departments/shared/_department_item.html.erb
+++ b/app/views/admins/departments/shared/_department_item.html.erb
@@ -1,3 +1,4 @@
+<%= list_index_no((params[:page] || 1).to_i, index) %> |
<% not_list = defined?(:users_count) %>
<%= overflow_hidden_span department.name, width: 150 %> |
diff --git a/app/views/admins/departments/shared/_list.html.erb b/app/views/admins/departments/shared/_list.html.erb
index 6af63d6f4..09ba2a65f 100644
--- a/app/views/admins/departments/shared/_list.html.erb
+++ b/app/views/admins/departments/shared/_list.html.erb
@@ -1,10 +1,11 @@
+ 序号 |
部门名称 |
单位名称 |
用户数 |
- 已职业认证 |
+ 已职业认证 |
部门管理员 |
统计链接 |
云主机数 |
@@ -14,9 +15,9 @@
<% if departments.present? %>
- <% departments.each do |department| %>
+ <% departments.each_with_index do |department, index| %>
- <%= render 'admins/departments/shared/department_item', department: department %>
+ <%= render partial: 'admins/departments/shared/department_item', locals: {department: department, index: index} %>
<% end %>
<% else %>
diff --git a/app/views/admins/departments/update.js.erb b/app/views/admins/departments/update.js.erb
index 359bac59c..d20ca9524 100644
--- a/app/views/admins/departments/update.js.erb
+++ b/app/views/admins/departments/update.js.erb
@@ -1,4 +1,6 @@
$('.modal.admin-edit-department-modal').modal('hide');
$.notify({ message: '操作成功' });
-$('.department-list-table .department-item-<%= current_department.id %>').html("<%= j(render partial: 'admins/departments/shared/department_item', locals: { department: current_department }) %>")
\ No newline at end of file
+var index = $(".department-item-<%= current_department.id %>").children(":first").html();
+$('.department-list-table .department-item-<%= current_department.id %>').html("<%= j(render partial: 'admins/departments/shared/department_item', locals: {department: current_department, index: 1}) %>");
+$(".department-item-<%= current_department.id %>").children(":first").html(index);
\ No newline at end of file
diff --git a/app/views/admins/identity_authentications/shared/_list.html.erb b/app/views/admins/identity_authentications/shared/_list.html.erb
index 607feb93a..6e12d1c54 100644
--- a/app/views/admins/identity_authentications/shared/_list.html.erb
+++ b/app/views/admins/identity_authentications/shared/_list.html.erb
@@ -3,6 +3,7 @@
+ 序号 |
<% unless is_processed %>
<%= check_box_tag('all-check', 1, false, id: nil, class: 'batch-all-check-box',
@@ -13,7 +14,7 @@
| 姓名 |
身份证号 |
学校/单位 |
- 职称 |
+ 职称 |
<% unless is_processed %>
照片
@@ -33,9 +34,10 @@
|
<% if applies.present? %>
- <% applies.each do |apply| %>
+ <% applies.each_with_index do |apply, index| %>
<% user = apply.user %>
+ <%= list_index_no((params[:page] || 1).to_i, index) %> |
<% unless is_processed %>
<%= check_box_tag('ids[]', apply.id, false, id: nil, class: 'batch-check-box') %> |
<% end %>
diff --git a/app/views/admins/laboratories/shared/_laboratory_item.html.erb b/app/views/admins/laboratories/shared/_laboratory_item.html.erb
index 81a45ca71..765616926 100644
--- a/app/views/admins/laboratories/shared/_laboratory_item.html.erb
+++ b/app/views/admins/laboratories/shared/_laboratory_item.html.erb
@@ -1,4 +1,5 @@
<% school = laboratory.school %>
+<%= list_index_no((params[:page] || 1).to_i, index) %> |
<%= school&.name || 'EduCoder主站' %> |
<% if laboratory.identifier %>
diff --git a/app/views/admins/laboratories/shared/_list.html.erb b/app/views/admins/laboratories/shared/_list.html.erb
index 2520b3276..a731be44a 100644
--- a/app/views/admins/laboratories/shared/_list.html.erb
+++ b/app/views/admins/laboratories/shared/_list.html.erb
@@ -1,6 +1,7 @@
+ 序号 |
单位名称 |
域名 |
统计链接 |
@@ -9,14 +10,14 @@
同步课堂 |
同步实践课程 |
同步实训 |
- 操作 |
+ 操作 |
<% if laboratories.present? %>
- <% laboratories.each do |laboratory| %>
+ <% laboratories.each_with_index do |laboratory, index| %>
- <%= render 'admins/laboratories/shared/laboratory_item', laboratory: laboratory %>
+ <%= render partial: 'admins/laboratories/shared/laboratory_item', locals: {laboratory: laboratory, index: index} %>
<% end %>
<% else %>
diff --git a/app/views/admins/laboratories/update.js.erb b/app/views/admins/laboratories/update.js.erb
index 1b9f307a6..149539ad6 100644
--- a/app/views/admins/laboratories/update.js.erb
+++ b/app/views/admins/laboratories/update.js.erb
@@ -1 +1,3 @@
-$(".laboratory-item-<%= @laboratory.id %>").html("<%= j render partial: "admins/laboratories/shared/laboratory_item",locals: {laboratory: @laboratory} %>")
\ No newline at end of file
+var index = $(".laboratory-item-<%= @laboratory.id %>").children(":first").html();
+$(".laboratory-item-<%= @laboratory.id %>").html("<%= j render partial: "admins/laboratories/shared/laboratory_item",locals: {laboratory: @laboratory, index: 1} %>");
+$(".laboratory-item-<%= @laboratory.id %>").children(":first").html(index);
\ No newline at end of file
diff --git a/app/views/admins/laboratories/update_sync_course.js.erb b/app/views/admins/laboratories/update_sync_course.js.erb
index 5ae68f673..663f56ee1 100644
--- a/app/views/admins/laboratories/update_sync_course.js.erb
+++ b/app/views/admins/laboratories/update_sync_course.js.erb
@@ -1 +1,3 @@
-$("#laboratory-item-<%= @laboratory.id %>").html("<%= j render partial: 'admins/laboratories/shared/laboratory_item', locals: {laboratory: @laboratory} %>")
\ No newline at end of file
+var index = $(".laboratory-item-<%= @laboratory.id %>").children(":first").html();
+$("#laboratory-item-<%= @laboratory.id %>").html("<%= j render partial: 'admins/laboratories/shared/laboratory_item', locals: {laboratory: @laboratory, index: 1} %>");
+$(".laboratory-item-<%= @laboratory.id %>").children(":first").html(index);
\ No newline at end of file
diff --git a/app/views/admins/laboratory_settings/show.html.erb b/app/views/admins/laboratory_settings/show.html.erb
index b99d6f022..ee9880fbb 100644
--- a/app/views/admins/laboratory_settings/show.html.erb
+++ b/app/views/admins/laboratory_settings/show.html.erb
@@ -129,6 +129,16 @@
+
+
+ <%- oj_banner = setting.oj_banner_url -%>
+ 开发者社区
+
+ ![](<%= oj_banner %>)
+ <%= file_field_tag(:oj_banner, accept: 'image/*', style: 'display: none', value: params[:oj_banner]) %>
+
+
+
diff --git a/app/views/admins/laboratory_shixuns/shared/_list.html.erb b/app/views/admins/laboratory_shixuns/shared/_list.html.erb
index e1244c472..462486f4b 100644
--- a/app/views/admins/laboratory_shixuns/shared/_list.html.erb
+++ b/app/views/admins/laboratory_shixuns/shared/_list.html.erb
@@ -1,21 +1,22 @@
- 实训名称 |
+ 序号 |
+ 实训名称 |
技术平台 |
技术体系 |
封面 |
创建者 |
- 状态 |
+ 状态 |
执行时间 |
操作 |
<% if laboratory_shixuns.present? %>
- <% laboratory_shixuns.each do |laboratory_shixun| %>
+ <% laboratory_shixuns.each_with_index do |laboratory_shixun, index| %>
- <%= render partial: 'admins/laboratory_shixuns/shared/td', locals: { laboratory_shixun: laboratory_shixun } %>
+ <%= render partial: 'admins/laboratory_shixuns/shared/td', locals: { laboratory_shixun: laboratory_shixun, index: index } %>
<% end %>
<% else %>
diff --git a/app/views/admins/laboratory_shixuns/shared/_td.html.erb b/app/views/admins/laboratory_shixuns/shared/_td.html.erb
index dbdf0df75..d987b53b4 100644
--- a/app/views/admins/laboratory_shixuns/shared/_td.html.erb
+++ b/app/views/admins/laboratory_shixuns/shared/_td.html.erb
@@ -1,5 +1,6 @@
<%- shixun = laboratory_shixun.shixun -%>
+<%= list_index_no((params[:page] || 1).to_i, index) %> |
<%= link_to "/shixuns/#{shixun.identifier}", target: '_blank' do %>
<%= shixun.name %>
diff --git a/app/views/admins/laboratory_subjects/shared/_list.html.erb b/app/views/admins/laboratory_subjects/shared/_list.html.erb
index 55f67dea8..c40d02260 100644
--- a/app/views/admins/laboratory_subjects/shared/_list.html.erb
+++ b/app/views/admins/laboratory_subjects/shared/_list.html.erb
@@ -1,7 +1,8 @@
- 课程名称 |
+ 序号 |
+ 课程名称 |
技术体系 |
等级体系 |
封面 |
@@ -13,10 +14,11 @@
<% if laboratory_subjects.present? %>
- <% laboratory_subjects.each do |laboratory_subject| %>
+ <% laboratory_subjects.each_with_index do |laboratory_subject, index| %>
<%- subject = laboratory_subject.subject -%>
+ <%= list_index_no((params[:page] || 1).to_i, index) %> |
<%= link_to(subject.name, "/paths/#{subject.id}", target: '_blank') %>
首页
diff --git a/app/views/admins/laboratory_users/create.js.erb b/app/views/admins/laboratory_users/create.js.erb
index f43fd7887..604e62943 100644
--- a/app/views/admins/laboratory_users/create.js.erb
+++ b/app/views/admins/laboratory_users/create.js.erb
@@ -1,4 +1,6 @@
$('.modal.admin-add-laboratory-user-modal').modal('hide');
$.notify({ message: '操作成功' });
-$('.laboratory-list-table .laboratory-item-<%= current_laboratory.id %>').html("<%= j(render partial: 'admins/laboratories/shared/laboratory_item', locals: { laboratory: current_laboratory }) %>")
\ No newline at end of file
+var index = $(".laboratory-item-<%= current_laboratory.id %>").children(":first").html();
+$('.laboratory-list-table .laboratory-item-<%= current_laboratory.id %>').html("<%= j(render partial: 'admins/laboratories/shared/laboratory_item', locals: {laboratory: current_laboratory, index: 1}) %>");
+$(".laboratory-item-<%= current_laboratory.id %>").children(":first").html(index);
\ No newline at end of file
diff --git a/app/views/admins/library_applies/shared/_list.html.erb b/app/views/admins/library_applies/shared/_list.html.erb
index 783d0db30..fde3d1d1a 100644
--- a/app/views/admins/library_applies/shared/_list.html.erb
+++ b/app/views/admins/library_applies/shared/_list.html.erb
@@ -3,11 +3,12 @@
+ 序号 |
头像 |
姓名 |
教学案例 |
案例描述 |
- 时间 |
+ 时间 |
<% if is_processed %>
拒绝原因 |
状态 |
@@ -18,10 +19,11 @@
<% if applies.present? %>
- <% applies.each do |apply| %>
+ <% applies.each_with_index do |apply, index| %>
<% user = apply.library.user %>
<% library = apply.library %>
+ <%= list_index_no((params[:page] || 1).to_i, index) %> |
<%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
diff --git a/app/views/admins/myshixuns/shared/_list.html.erb b/app/views/admins/myshixuns/shared/_list.html.erb
index 440437320..a80a4ef23 100644
--- a/app/views/admins/myshixuns/shared/_list.html.erb
+++ b/app/views/admins/myshixuns/shared/_list.html.erb
@@ -1,9 +1,10 @@
+ 序号 |
ID |
标识 |
- 实训名称 |
+ 实训名称 |
实训老师 |
完成 |
经验值 |
@@ -14,8 +15,9 @@
<% if myshixuns.present? %>
- <% myshixuns.each do |myshixun| %>
+ <% myshixuns.each_with_index do |myshixun, index| %>
+ <%= list_index_no(@params_page.to_i, index) %> |
<%= myshixun.id %> |
<%= myshixun.identifier %> |
diff --git a/app/views/admins/partners/shared/_list.html.erb b/app/views/admins/partners/shared/_list.html.erb
index 0bebc2a4b..71153c175 100644
--- a/app/views/admins/partners/shared/_list.html.erb
+++ b/app/views/admins/partners/shared/_list.html.erb
@@ -1,15 +1,17 @@
- 名称 |
+ 序号 |
+ 名称 |
<%= sort_tag('添加时间', name: 'created_at', path: admins_partners_path) %> |
操作 |
<% if partners.present? %>
- <% partners.each do |partner| %>
+ <% partners.each_with_index do |partner, index| %>
+ <%= list_index_no((params[:page] || 1).to_i, index) %> |
<%= link_to partner.school&.name || partner.name, customers_partner_path(partner), target: '_blank' %>
|
diff --git a/app/views/admins/professional_authentications/shared/_list.html.erb b/app/views/admins/professional_authentications/shared/_list.html.erb
index 6ec6355ba..7ffa5837e 100644
--- a/app/views/admins/professional_authentications/shared/_list.html.erb
+++ b/app/views/admins/professional_authentications/shared/_list.html.erb
@@ -3,6 +3,7 @@
+ 序号 |
<% unless is_processed %>
<%= check_box_tag('all-check', 1, false, id: nil, class: 'batch-all-check-box',
@@ -12,7 +13,7 @@
| 头像 |
姓名 |
学校/单位 |
- 职称 |
+ 职称 |
<% unless is_processed %>
照片
@@ -31,9 +32,10 @@
|
<% if applies.present? %>
- <% applies.each do |apply| %>
+ <% applies.each_with_index do |apply, index| %>
<% user = apply.user %>
+ <%= list_index_no((params[:page] || 1).to_i, index) %> |
<% unless is_processed %>
<%= check_box_tag('ids[]', apply.id, false, id: nil, class: 'batch-check-box') %> |
<% end %>
diff --git a/app/views/admins/project_package_applies/shared/_list.html.erb b/app/views/admins/project_package_applies/shared/_list.html.erb
index d94c96184..bec0912ca 100644
--- a/app/views/admins/project_package_applies/shared/_list.html.erb
+++ b/app/views/admins/project_package_applies/shared/_list.html.erb
@@ -3,11 +3,12 @@
+ 序号 |
头像 |
姓名 |
众包需求 |
需求描述 |
- 时间 |
+ 时间 |
<% if is_processed %>
拒绝原因 |
状态 |
@@ -18,10 +19,11 @@
<% if applies.present? %>
- <% applies.each do |apply| %>
+ <% applies.each_with_index do |apply, index| %>
<% package = apply.project_package %>
<% user = package.creator %>
+ <%= list_index_no((params[:page] || 1).to_i, index) %> |
<%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
diff --git a/app/views/admins/projects/shared/_list.html.erb b/app/views/admins/projects/shared/_list.html.erb
index 8a84a72d0..e2a6307ad 100644
--- a/app/views/admins/projects/shared/_list.html.erb
+++ b/app/views/admins/projects/shared/_list.html.erb
@@ -1,6 +1,7 @@
+ 序号 |
ID |
项目名称 |
公开 |
@@ -11,14 +12,15 @@
里程碑 |
成员 |
管理员 |
- <%= sort_tag('创建时间', name: 'created_at', path: admins_projects_path) %> |
+ <%= sort_tag('创建时间', name: 'created_at', path: admins_projects_path) %> |
操作 |
<% if projects.present? %>
- <% projects.each do |project| %>
+ <% projects.each_with_index do |project, index| %>
+ <%= list_index_no((params[:page] || 1).to_i, index) %> |
<%= project.id %> |
<%= link_to(project.name, "/projects/#{project.id}", target: '_blank') %>
diff --git a/app/views/admins/school_statistics/shared/_list.html.erb b/app/views/admins/school_statistics/shared/_list.html.erb
index aa043f097..9d2a1c209 100644
--- a/app/views/admins/school_statistics/shared/_list.html.erb
+++ b/app/views/admins/school_statistics/shared/_list.html.erb
@@ -20,7 +20,8 @@
- 单位名称 |
+ 序号 |
+ 单位名称 |
<%= sort_tag('新增教师', name: 'teacher_increase_count', path: admins_school_statistics_path) %> |
<%= sort_tag('新增学生', name: 'student_increase_count', path: admins_school_statistics_path) %> |
<%= sort_tag('新增课堂', name: 'course_increase_count', path: admins_school_statistics_path) %> |
@@ -32,8 +33,9 @@
<% if statistics.present? %>
- <% statistics.each do |statistic| %>
+ <% statistics.each_with_index do |statistic, index| %>
+ <%= list_index_no(@params_page.to_i, index) %> |
<%= link_to statistic.school_name, "/colleges/#{statistic.school_id}/statistics",
target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %>
diff --git a/app/views/admins/schools/index.html.erb b/app/views/admins/schools/index.html.erb
index 9c41067ee..56cbadd9d 100644
--- a/app/views/admins/schools/index.html.erb
+++ b/app/views/admins/schools/index.html.erb
@@ -4,7 +4,7 @@
| | | | | | | | | | |