dev_partners
Alec Zhou 6 years ago
commit 0dd03710ae

@ -1,5 +1,5 @@
class Managements::BaseController < ApplicationController
layout 'base_management'
before_filter :require_admin
before_filter :require_business
end

@ -24,10 +24,8 @@ class Management::SchoolDataContrastService
reports = reports.where("school_name LIKE :keyword OR school_id LIKE :keyword", keyword: "%#{keyword}%")
end
reports = reports.group(:school_id)
count = reports.count.count
reports = reports.limit(PAGE_SIZE).offset(offset)
count = reports.count('distinct(school_id)')
reports = reports.group(:school_id).limit(PAGE_SIZE).offset(offset)
[count, reports]
end
@ -56,7 +54,7 @@ class Management::SchoolDataContrastService
end
def select_columns
"school_id, school_name,"\
"school_id, school_name, @total:=0, @other_total:=0,"\
"(@total:=SUM(IF(date BETWEEN '#{format_date(params[:begin_date])}' AND '#{format_date(params[:end_date])}', #{contrast_column}, 0))) total,"\
"(@other_total:=SUM(IF(date BETWEEN '#{format_date(params[:other_begin_date])}' AND '#{format_date(params[:other_end_date])}', #{contrast_column}, 0))) other_total,"\
"(IF(@other_total - @total = 0, 0.0, round((@other_total - @total) / IF(@total = 0, 1, @total), 5))) percentage,"\

@ -188,7 +188,7 @@
<label class="panel-form-label fl mr18">运营人员:</label>
<span class="fl">
<input type="checkbox" <%= @user.business? ? "checked" : "" %> name="business" value="<%= @user.business? ? "1" : "0" %>" id="person_business" class="magic-checkbox" style="float:left; margin-top: 8px;">
<label for="person_business"><%= @user.business? %></label>
<label for="person_business"></label>
</span>
</li>
<li class="clearfix mb10 hascontont">
@ -621,6 +621,13 @@
$("#user_form_link").on("click",function(){
var check = document.getElementById('person_business').checked;
if(check){
document.getElementById('person_business').value = "1";
}else{
document.getElementById('person_business').value = "0";
}
my_account_form_submit();
});
function my_account_form_submit(){

@ -0,0 +1,9 @@
class AddIndexToSchoolDailyReports < ActiveRecord::Migration
def change
add_index :school_daily_reports, [:date, :teacher_increase_count]
add_index :school_daily_reports, [:date, :student_increase_count]
add_index :school_daily_reports, [:date, :course_increase_count]
add_index :school_daily_reports, [:date, :shixun_increase_count]
add_index :school_daily_reports, [:date, :active_user_count]
end
end
Loading…
Cancel
Save