dev_ec
cxt 6 years ago
commit 6a80a0bbf1

@ -2,7 +2,7 @@
class ChallengesController < ApplicationController
layout "base_shixun"
# 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位
#before_filter :handle_openi_request, if: -> { user_login_and_from_openi? }, only: [:index]
before_filter :handle_openi_request, if: -> { user_login_and_from_openi? }, only: [:index]
before_filter :check_authentication, :except => [:index]
before_filter :find_shixun, :only => [:index, :new, :create, :destroy, :challenge_build, :update_evaluation, :add_choose_question, :new_choose_question,
:choose_type_show, :edit_choose_question, :update_choose_question, :destroy_challenge_choose]

@ -3476,7 +3476,7 @@ end
type = params[:type]
search = params[:search]
if type == "0"
authentication_user = AuthenticationsUsers.where(user_id => apply_action.user_id).first
authentication_user = AuthenticationsUsers.where(user_id: apply_action.user_id).first
if authentication_user.blank?
AuthenticationsUsers.create(:user_id => apply_action.user_id, :authentication_id => 1)
end
@ -3511,14 +3511,17 @@ end
apply_action.update_attributes(status: (params[:type] == "1" ? 2 : 1), reason: reject_reason, reject_description: params[:reject_description], dealer_id: User.current.id, noticed: false)
User.where(:id => apply_action.user_id).first.update_attributes(:certification => (params[:type] == "1" ? 2 : 1))
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user)
@autu_count = @authorizations.count
@limit = 15
@is_remote = true
@autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1
@offset ||= @autu_pages.offset
@authorizations = paginateHelper @authorizations, @limit
if params[:reject_type] != "revocation"
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user)
@autu_count = @authorizations.count
@limit = 15
@is_remote = true
@autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1
@offset ||= @autu_pages.offset
@authorizations = paginateHelper @authorizations, @limit
end
respond_to do |format|
format.js
end

@ -2,7 +2,7 @@
class SubjectsController < ApplicationController
layout 'base_subject'
# 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位
#before_filter :handle_openi_request, if: -> { user_login_and_from_openi? }, only: [:show]
before_filter :handle_openi_request, if: -> { user_login_and_from_openi? }, only: [:show]
before_filter :require_login, :except => [:show, :index]
before_filter :check_authentication, :except => [:show, :index]
before_filter :find_subject, :except => [:index, :new, :create, :create_subject, :new_subject, :append_to_stage, :send_to_course]

@ -4,7 +4,7 @@ module ManagementsHelper
def user_phone_addr phone
addr = "--"
unless phone.nil?
result = nil # MobInfo.lookup(phone[0,7])
result = MobInfo.lookup(phone[0,7])
if result.present?
addr = "#{result[:province]}-#{result[:city]}"
end
@ -15,7 +15,7 @@ module ManagementsHelper
def user_ip_addr ip
addr = "--"
unless ip.nil?
result = nil # SM.find_by_ip(ip)
result = SM.find_by_ip(ip)
if result.present?
addr = "#{result[:province]}-#{result[:city]}"
end

@ -42,7 +42,7 @@ class Management::SchoolReportService
shixun_homework_map = homeworks.where(homework_type: 4, courses: { school_id: ids }).group('school_id').count
other_homework_map = homeworks.where(homework_type: [1, 3], courses: { school_id: ids }).group('school_id').count
courses = Course.where(school_id: ids).group('school_id')
courses = Course.where(is_delete: 0, school_id: ids).group('school_id')
course_map = courses.count
nearly_course_time_map = courses.joins(:course_activities).maximum('course_activities.updated_at')
active_course_map = courses.where(is_end: false).count
@ -76,11 +76,15 @@ class Management::SchoolReportService
when 'other_homework_count' then
schools.joins(courses: :other_homework_commons).select("#{base_query_column}, COUNT(*) other_homework_count")
when 'course_count' then
schools.joins(:courses).select("#{base_query_column}, COUNT(*) course_count")
schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0')
.select("#{base_query_column}, COUNT(*) course_count")
when 'nearly_course_time' then
schools.joins(courses: :course_activities).select("#{base_query_column}, MAX(course_activities.updated_at) nearly_course_time")
schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0')
.joins('LEFT JOIN course_activities acs ON acs.course_id = cs.id')
.select("#{base_query_column}, MAX(acs.updated_at) nearly_course_time")
when 'active_course_count' then
schools.joins(:active_courses).select("#{base_query_column}, COUNT(*) active_course_count")
schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0 AND cs.is_end = false')
.select("#{base_query_column}, COUNT(*) active_course_count")
else
schools.joins(:teacher_extensions).select("#{base_query_column}, COUNT(*) teacher_count")
end

@ -1,6 +1,6 @@
<div class="modal reject-auth-modal" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: 100;display: none;">
<div class="mask" style="position: absolute;width: 100%;height: 100%;background:rgba(0,0,0,1);opacity:0.5;"></div>
<div class="task-popup" style="width:600px;position: relative;margin: 100px auto 0;border-radius:10px;">
<div class="task-popup" style="width:600px;position: relative;margin: 80px auto 0;border-radius:10px;">
<div class=" task-popup-title clearfix task-popup-bggrey">
<%= title %>
</div>
@ -62,6 +62,8 @@
<textarea class="remarktextarea fl panel-box-sizing candiate_answer" name="reject_description" placeholder="为选择的撤销原因补充备注说明...."></textarea>
</li>
<li class="ml20 error color-red" style="display: none;"></li>
<li class="clearfix mt20 edu-txt-center mb20">
<a href="javascript:void(0);" class="task-btn mr10 cancel-btn">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20 submit-btn">确定</a>
@ -77,11 +79,23 @@
var modal = $(".modal.reject-auth-modal");
var form = modal.find("#reject-auth-form");
var applyIdInput = form.find("input[name='apply_id']");
var error = modal.find(".error");
modal.on('click', '.submit-btn', function(){
if (!formValid()) { return; }
form.submit();
});
var formValid = function () {
error.html("").hide();
if (form.find("input[name='reasons[]']:checked").length == 0 || form.find("textarea[name='reject_description']").val() == '') {
error.html("原因和说明不能为空,请完善后再确认提交").show();
return false;
}
return true;
};
var hideRejectModalFunc = function(){
applyIdInput.val('');
form.find("textarea[name='reject_description']").val('');

@ -4,9 +4,9 @@ wb.add_worksheet(name: '统计总表') do |sheet|
@schools.each do |school|
sheet.add_row([
school['id'].to_s, school['name'].to_s, (school['teacher_count'] || 0).to_s, (school['student_count'] || 0).to_s,
(school['course_count'] || 0).to_s, (school['active_course_count'] || 0).to_s, (school['homework_count'] || 0).to_s,
(school['other_homework_count'] || 0).to_s, format_time(school['nearly_course_time'])
school[:id].to_s, school[:name].to_s, (school[:teacher_count] || 0).to_s, (school[:student_count] || 0).to_s,
(school[:course_count] || 0).to_s, (school[:active_course_count] || 0).to_s, (school[:homework_count] || 0).to_s,
(school[:other_homework_count] || 0).to_s, format_time(school[:nearly_course_time])
])
end
end

@ -0,0 +1,5 @@
class AddIndexToCourses < ActiveRecord::Migration
def change
add_index :courses, [:school_id, :is_delete]
end
end
Loading…
Cancel
Save