From ef5095c0708af055857def19d43f16897a1abcb9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sun, 28 Apr 2019 12:00:32 +0800 Subject: [PATCH 01/10] 1 --- app/views/layouts/base_management.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index 9d1d77c8..e038f1c2 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -113,9 +113,9 @@
  • 审批 - <% if User.current.logged? %> -
    - <%= link_to (image_tag(url_to_avatar(User.current), :width =>"34", :height => "34", :class => "radius mt13", :nhname => "avatar_image", :alt=>"头像", :id => "nh_user_logo")), user_path(User.current),:class => "fl" %> - -
    - <% else %> - - <%= link_to '登录', signin_path, :class => "mr5 color-white" %> - - <%= link_to '注册', user_join_path, :class => "ml5 color-white" %> - - <% end %> +
    + <%= link_to (image_tag(url_to_avatar(User.current), :width =>"34", :height => "34", :class => "radius mt13", :nhname => "avatar_image", :alt=>"头像", :id => "nh_user_logo")), user_path(User.current),:class => "fl" %> + +
    @@ -58,9 +73,7 @@
      - <% unless User.current.user_extensions.try(:identity) == 1 %> -
    • <%= link_to '新建课堂', new_course_path() %>
    • - <% end %> +
    • <%= link_to '新建课堂', new_course_path() %>
    • <%= link_to '新建实训', new_shixun_path() %>
    • <%= link_to '新建实训课程', new_subject_path() %>
    • <%= link_to '新建项目', new_project_path() %>
    • @@ -72,6 +85,22 @@
    + +
    + + + + + <% new_tidings_count = User.current.tidings.where("created_at > '#{User.current.onclick_time.onclick_time}'").count %> + <% new_pri_message_count = User.current.private_messages.where("created_at > '#{User.current.onclick_time.onclick_time}'").count %> + <% count = new_tidings_count + new_pri_message_count %> + <% if count > 0 %> + <%= count > 99 ? "99+" : count %> + + <% end %> +
    diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index 72dd2731..f38a1dce 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -8,36 +8,47 @@
  • "><%= link_to "开发社区", shixuns_path %>
  • + <% careers = Career.published.order("created_at asc") %> + <% if careers.present? %> +
  • " style="cursor: auto;"> +

    职业路径

    + +
  • + <% end %>
  • "><%= link_to "竞赛", competitions_path %>
  • "><%= link_to "问答", forums_path %>
  • - + <%= link_to '登录', signin_path, :class => "mr5 color-white" %> - - <%= link_to '注册', user_join_path, :class => "ml5 color-white" %> + + <%= link_to '注册', user_join_path, :class => "ml5 color-white" %>
    @@ -55,8 +66,8 @@
  • <%= link_to '新建项目', new_project_path() %>
    • -
    • <%= link_to "加入课堂", signin_path, :remote => true %>
    • -
    • <%= link_to "加入项目", applied_join_project_path, :remote => true %>
    • +
    • <%= link_to "加入课堂", signin_path, :remote => true %>
    • +
    • <%= link_to "加入项目", applied_join_project_path, :remote => true %>
    From 0817dc9e86196df0cb019f1bcf406746401eba1f Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 29 Apr 2019 16:44:52 +0800 Subject: [PATCH 03/10] remove whenever gem --- Gemfile | 3 --- config/schedule.rb | 24 -------------------- lib/tasks/statistic_school_daily_report.rake | 5 ++++ 3 files changed, 5 insertions(+), 27 deletions(-) delete mode 100644 config/schedule.rb diff --git a/Gemfile b/Gemfile index 9ff7d11f..b9e1b4e2 100644 --- a/Gemfile +++ b/Gemfile @@ -62,9 +62,6 @@ gem 'elasticsearch-rails' gem 'oauth2' -# cronjob -gem 'whenever', require: false - #Ruby 2.2+ has removed test/unit from the core library. if RUBY_VERSION>='2.2' gem 'test-unit', '~> 3.0' diff --git a/config/schedule.rb b/config/schedule.rb deleted file mode 100644 index 380494c6..00000000 --- a/config/schedule.rb +++ /dev/null @@ -1,24 +0,0 @@ -# Use this file to easily define all of your cron jobs. -# -# It's helpful, but not entirely necessary to understand cron before proceeding. -# http://en.wikipedia.org/wiki/Cron - -# Example: -# -# set :output, "/path/to/my/cron_log.log" -# -# every 2.hours do -# command "/usr/bin/some_great_command" -# runner "MyModel.some_method" -# rake "some:great:rake:task" -# end -# -# every 4.days do -# runner "AnotherModel.prune_old_records" -# end - -# Learn more: http://github.com/javan/whenever - -every 1.days, at: '5:00 am' do - runner 'StatisticSchoolDailyReportTask.new.call' -end diff --git a/lib/tasks/statistic_school_daily_report.rake b/lib/tasks/statistic_school_daily_report.rake index 84b65204..67604fff 100644 --- a/lib/tasks/statistic_school_daily_report.rake +++ b/lib/tasks/statistic_school_daily_report.rake @@ -1,6 +1,11 @@ #coding=utf-8 namespace :school_daily_report do + desc 'daily statistic school task' + task daily_statistic: :environment do + StatisticSchoolDailyReportTask.new.call + end + desc 'statistic school daily report data before now' task :statistic, [:date] => :environment do |_, args| date = Time.zone.parse(args[:date]).beginning_of_day From 8cce3e27ba4a63693627e1ca233dab05280e8217 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 29 Apr 2019 16:57:27 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=92=8C=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=88=A0=E9=99=A4=E7=9A=84=E5=AE=9E=E8=AE=AD=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E9=80=9A=E8=BF=87=E8=BF=9E=E6=8E=A5=E8=AE=BF?= =?UTF-8?q?=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 2 +- app/models/shixun.rb | 7 ++++++- app/services/games_service.rb | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 685f9f74..df1da6ca 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -467,7 +467,7 @@ class ChallengesController < ApplicationController render_404 return else - if (@shixun.status == 0 && !User.current.manager_of_shixun?(@shixun)) || @shixun.status == -1 + if (@shixun.status == 0 && !User.current.manager_of_shixun?(@shixun)) || (!@shixun.operable? && !User.current.admin?) render_403 return end diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 54882be1..c7d0460a 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -62,13 +62,18 @@ class Shixun < ActiveRecord::Base include ApplicationHelper has_many :tidings, :as => :container, :dependent => :destroy - scope :visible, -> { where(status: -1) } + #scope :visible, -> { where(status: -1) } after_create :send_tiding def should_compile? self.mirror_repositories.published_main_mirror.first.try(:should_compile) end + # 可供使用的实训 + def operable? + self.status != -1 && !self.hidden + end + def is_published? self.status > 1 ? true : false end diff --git a/app/services/games_service.rb b/app/services/games_service.rb index bddb03b7..f172edbd 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -17,7 +17,8 @@ class GamesService myshixun = Myshixun.min.find(game.myshixun_id) shixun = Shixun.min.find(myshixun.shixun_id) - unless (myshixun.user_id == current_user.id || current_user.admin? || current_user.business? || current_user.id == shixun.try(:user_id) || current_user.is_certification_teacher) + unless ((myshixun.user_id == current_user.id || current_user.business? || current_user.id == shixun.try(:user_id) || + current_user.is_certification_teacher) && (shixun.operable?)) || current_user.admin? return{:status => 403} end game_challenge = Challenge.min.find(game.challenge_id) From 5002fd8a5cc6a31f6c91b7996379e1dd6fd6e9f6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 30 Apr 2019 09:45:32 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E6=97=B6=E8=BF=87=E6=BB=A4=E6=8E=89=E5=88=A0=E9=99=A4=E7=9A=84?= =?UTF-8?q?=E5=AE=9E=E8=AE=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8c7a1278..64e7aa86 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -940,7 +940,7 @@ class UsersController < ApplicationController @limit = 16 if 1 == @index # @shixuns_result = Shixun.where(:status => [2,3]).where("name like ?", "%#{@search}%").reorder("created_at desc") - @shixuns_result = Shixun.where("name like ? and hidden=0", "%#{@search}%").reorder("myshixuns_count desc") + @shixuns_result = Shixun.where("name like ? and hidden=0 and status != -1", "%#{@search}%").reorder("myshixuns_count desc") @shixuns_result_count = @shixuns_result.count @shixun_pages = Paginator.new @shixuns_result_count, @limit, params['page'] || 1 @offset ||= @shixun_pages.offset From fdec1f663debf88a13bb825aefc1bb864dfb1147 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 30 Apr 2019 10:51:11 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=9A=84=E8=AF=95=E7=94=A8=E6=8E=88=E6=9D=83=E2=80=9C?= =?UTF-8?q?=E5=B7=B2=E5=AE=A1=E6=89=B9=E2=80=9D=E5=A2=9E=E5=8A=A0=E5=AD=A6?= =?UTF-8?q?=E9=99=A2=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/colleges_controller.rb | 58 ++++++++++--------- app/models/school.rb | 2 +- app/views/colleges/_student_eval.html.erb | 8 +-- app/views/colleges/statistics.html.erb | 8 +-- .../_trial_authorization_passed_list.html.erb | 2 +- 5 files changed, 40 insertions(+), 38 deletions(-) diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index df500de8..960030c9 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -44,31 +44,31 @@ class CollegesController < ApplicationController def statistics logger.info("#########################{params}") @teachers_count = User.find_by_sql("SELECT COUNT(users.`id`) AS teacher_count FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE - user_extensions.`school_id` = #{@department.school_id} AND user_extensions.`identity` = 0").first.try(:teacher_count) + user_extensions.`school_id` = #{@school.id} AND user_extensions.`identity` = 0").first.try(:teacher_count) @students_count = User.find_by_sql("SELECT COUNT(users.`id`) AS student_count FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE - user_extensions.`school_id` = #{@department.school_id} AND user_extensions.`identity` = 1").first.try(:student_count) + user_extensions.`school_id` = #{@school.id} AND user_extensions.`identity` = 1").first.try(:student_count) # Redo:这样做内存会卡死的 - # user_ids = User.find_by_sql("SELECT users.id FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{@department.school_id}").map(&:id) + # user_ids = User.find_by_sql("SELECT users.id FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{@school.id}").map(&:id) # Redo:是否直接使用count会更好 - all_course_ids = Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("courses.id != 1309 and ue.school_id = #{@department.school_id}") + all_course_ids = Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("courses.id != 1309 and ue.school_id = #{@school.id}") @courses_count = all_course_ids.size # Redo:对于量比较大的尽量不使用笛卡尔积 # @shixuns_count = Shixun.where(:status => [2, 3], :user_id => user_ids).size @shixuns_count = Shixun.find_by_sql("select count(s.id) as shixun_count from users u right join shixuns s on u.id=s.user_id and s.status in (2, 3) inner join user_extensions ue on - u.id=ue.user_id and ue.school_id=#{@department.school_id}").first.try(:shixun_count) + u.id=ue.user_id and ue.school_id=#{@school.id}").first.try(:shixun_count) # @shixun_time_sum = (Game.where(:user_id => user_ids).pluck(:cost_time).sum / (24*60*60.0)).ceil @shixun_time_sum = (Game.find_by_sql("select sum(g.cost_time) cost_time from users u RIGHT join games g on u.id=g.user_id inner join user_extensions ue on - u.id=ue.user_id and ue.school_id=#{@department.school_id}").first.try(:cost_time).to_i / (24 * 60 * 60.0)).ceil + u.id=ue.user_id and ue.school_id=#{@school.id}").first.try(:cost_time).to_i / (24 * 60 * 60.0)).ceil # select count(sw.id) from users u left join student_works sw on u.id=sw.user_id and sw.myshixun_id is not null and sw.work_status !=0 inner join user_extensions ue on u.id=ue.user_id and ue.school_id=117 ; # @shixun_report_count = StudentWork.where("work_status != 0 and user_id in (#{user_ids.join(',').strip == "" ? -1 : user_ids.join(',')}) and myshixun_id is not null").count @shixun_report_count = StudentWork.find_by_sql("SELECT count(*) as sw_count FROM `student_works` where user_id in (SELECT users.id FROM users RIGHT JOIN user_extensions ON users.id=user_extensions.user_id WHERE - user_extensions.`school_id`=#{@department.school_id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count) + user_extensions.`school_id`=#{@school.id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count) @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, members m, member_roles mr WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) AND m.user_id=users.id AND c.is_delete = 0) as course_count - FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@department.school_id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10") + FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@school.id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10") # ).order("publish_shixun_count desc, experience desc").limit(10) @teachers = @teachers.map do |teacher| @@ -131,7 +131,7 @@ class CollegesController < ApplicationController (select count(m.id) from messages m inner join boards b on b.id=m.board_id and b.parent_id=0 where b.course_id=c.id group by c.id) as messages_count, c.tea_id, c.name, c.is_end, (SELECT MAX(created_at) FROM `course_activities` ca WHERE ca.course_id = c.id) AS update_time - FROM `courses` c WHERE (c.school_id = #{@department.school_id} and c.is_delete = 0)") + FROM `courses` c WHERE (c.school_id = #{@school.id} and c.is_delete = 0)") @courses.each do |course| course[:evaluating_count] = Output.find_by_sql("select sum(g.evaluate_count) as evaluating_count from games g inner join @@ -157,11 +157,11 @@ class CollegesController < ApplicationController # 学生实训 def student_shixun - user_ids = User.find_by_sql("SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@department.school_id}").map(&:id) + user_ids = User.find_by_sql("SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@school.id}").map(&:id) @students = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, users.grade, users.experience, ue.student_id, (SELECT COUNT(myshixuns.id) FROM `myshixuns` WHERE myshixuns.user_id = users.id AND myshixuns.status = 1 GROUP BY users.id) AS myshixun_count FROM users join user_extensions ue on - users.id = ue.user_id where ue.school_id = #{@department.school_id} AND ue.identity = 1 AND `users`.`type` IN ('User', 'AnonymousUser') ORDER BY experience DESC, myshixun_count DESC LIMIT 10") + users.id = ue.user_id where ue.school_id = #{@school.id} AND ue.identity = 1 AND `users`.`type` IN ('User', 'AnonymousUser') ORDER BY experience DESC, myshixun_count DESC LIMIT 10") ## outputs基数过大,用inner join有奇效 @shixun_tags = TagRepertoire.find_by_sql(%Q{ @@ -172,7 +172,7 @@ class CollegesController < ApplicationController AND str.shixun_id = myshixuns.`shixun_id` AND myshixuns.id = games.`myshixun_id` AND myshixuns.`user_id` IN ( - SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@department.school_id} + SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@school.id} ) ) a on a.id = outputs.game_id and outputs.`test_set_position` = 1 group by trid ORDER BY test_count DESC @@ -197,50 +197,50 @@ class CollegesController < ApplicationController @eval_data = [] case @index when "day" - same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(end_day - 365.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 365.days).end_of_day}'").first.try(:count).to_i - last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(end_day - 1.day).beginning_of_day}' AND outputs.created_at < '#{(end_day - 1.day).end_of_day}'").first.try(:count).to_i @time_range = "#{end_day.strftime("%Y-%m-%d")}~#{end_day.strftime("%Y-%m-%d")}" @time_data = ["2:00", "4:00", "6:00", "8:00", "10:00", "12:00", "14:00", "16:00", "18:00", "20:00", "22:00", "24:00"] for i in 0..11 - @eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + @eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{end_day.beginning_of_day + (i * 2).hour}' AND outputs.created_at < '#{end_day.beginning_of_day + ((i + 1) * 2).hour}'").first.try(:count).to_i end when "week" start_day = end_day - 6.days - same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day - 365.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 365.days).end_of_day}'").first.try(:count).to_i - last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day - 7.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 7.days).end_of_day}'").first.try(:count).to_i @time_range = "#{start_day.strftime("%Y-%m-%d")}~#{end_day.strftime("%Y-%m-%d")}" for i in 0..6 @time_data << (start_day + i.days).strftime("%m.%d") - @eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + @eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day + i.days).beginning_of_day}' AND outputs.created_at < '#{(start_day + (i + 1).days).end_of_day}'").first.try(:count).to_i end when "mon" start_day = end_day - 30.days - same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day - 365.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 365.days).end_of_day}'").first.try(:count).to_i - last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + last_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day - 30.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 30.days).end_of_day}'").first.try(:count).to_i @time_range = "#{start_day.strftime("%Y-%m-%d")}~#{end_day.strftime("%Y-%m-%d")}" for i in 0..9 @time_data << (start_day + (3 * i).days).strftime("%m.%d") - @eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + @eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day + (3 * i).days).beginning_of_day}' AND outputs.created_at < '#{(start_day + (3 * (i + 1)).days).end_of_day}'").first.try(:count).to_i end when "year" start_day = end_day - 365.days - same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + same_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day - 365.days).beginning_of_day}' AND outputs.created_at < '#{(end_day - 365.days).end_of_day}'").first.try(:count).to_i last_count = same_count @time_range = "#{start_day.strftime("%Y-%m-%d")}~#{end_day.strftime("%Y-%m-%d")}" for i in 0..11 @time_data << (start_day + i.month).strftime("%m.%d") - @eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + @eval_data << Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{(start_day + i.days).beginning_of_day}' AND outputs.created_at < '#{(start_day + (i + 1).days).end_of_day}'").first.try(:count).to_i end end @@ -248,9 +248,9 @@ class CollegesController < ApplicationController @same_rate = (@new_count == 0 || same_count == 0) ? 0 : (@new_count * 1.0 / same_count - 1).to_f @last_rate = (@new_count == 0 || last_count == 0) ? 0 : (@new_count * 1.0 / last_count - 1).to_f - @total_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + @total_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 ").first.try(:count).to_i - @trend_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@department.school_id}) b + @trend_count = Output.find_by_sql("select count(outputs.id) as count from outputs RIGHT JOIN (SELECT games.id FROM games RIGHT JOIN user_extensions ue ON games.`user_id` = ue.`user_id` AND ue.`school_id`=#{@school.id}) b ON outputs.`game_id` = b.id WHERE outputs.test_set_position = 1 AND outputs.created_at > '#{Time.now - 7.days}'").first.try(:count).to_i end @@ -259,9 +259,9 @@ class CollegesController < ApplicationController def manager_auth # unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?) unless (User.current.admin? || User.current.business? || - DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? || - (User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0) || - (@department.school.try(:customer_id) && User.current.try(:partner).try(:customer_ids) && User.current.try(:partner).try(:customer_ids).include?(@department.school.try(:customer_id)))) + (@department.present? && DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?) || + (User.current.user_extensions.try(:school_id) == @school.id && User.current.user_extensions.try(:identity) == 0) || + (@school.try(:customer_id) && User.current.try(:partner).try(:customer_ids) && User.current.try(:partner).try(:customer_ids).include?(@school.try(:customer_id)))) render_403 end end @@ -270,6 +270,8 @@ class CollegesController < ApplicationController @department = Department.find_by_identifier(params[:id]) if @department.present? @school = @department.school + else + @school = School.find_by_id(params[:id]) end rescue ActiveRecord::RecordNotFound render_404 diff --git a/app/models/school.rb b/app/models/school.rb index 021048fb..081f3c0c 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -64,7 +64,7 @@ class School < ActiveRecord::Base def statistic_url dep = departments.where("identifier is not null").first - url = dep.present? ? "/colleges/#{dep.identifier}/statistics" : "" + url = dep.present? ? "/colleges/#{dep.identifier}/statistics" : "/colleges/#{self.id}/statistics" end def course_act_time diff --git a/app/views/colleges/_student_eval.html.erb b/app/views/colleges/_student_eval.html.erb index 2f3d47bc..be5bd078 100644 --- a/app/views/colleges/_student_eval.html.erb +++ b/app/views/colleges/_student_eval.html.erb @@ -30,10 +30,10 @@
  • - ">日 - ">周 - ">月 - ">年 + ">日 + ">周 + ">月 + ">年
  • diff --git a/app/views/colleges/statistics.html.erb b/app/views/colleges/statistics.html.erb index e0d93cfa..15535571 100644 --- a/app/views/colleges/statistics.html.erb +++ b/app/views/colleges/statistics.html.erb @@ -44,15 +44,15 @@
  • <%= @shixuns_count %>
  • <%= @shixun_report_count %>
  • <%= @shixun_time_sum %>
  • -
  • <%= @department.host_count.to_i %>
  • +
  • <%= @department.present? ? @department.host_count.to_i : @school.departments.first.try(:host_count).to_i %>
  • 课堂
  • -
  • 学生实训
  • +
  • 学生实训
  • -
  • 学生测评
  • +
  • 学生测评
  • @@ -153,7 +153,7 @@ }) }); - $.get('<%= course_statistics_college_path(@department) %>'); + $.get('<%= course_statistics_college_path(@school) %>'); $(".count_student_test a").click(function(){ $(".count_student_test a").removeClass("active"); diff --git a/app/views/managements/_trial_authorization_passed_list.html.erb b/app/views/managements/_trial_authorization_passed_list.html.erb index 2a07d59a..450058ee 100644 --- a/app/views/managements/_trial_authorization_passed_list.html.erb +++ b/app/views/managements/_trial_authorization_passed_list.html.erb @@ -17,7 +17,7 @@
  • <% if !user.try(:user_extensions).school_id.blank? && user.try(:user_extensions).try(:school) %> - <%= user.try(:user_extensions).school.name %><%= user.try(:user_extensions).department ? ' - '+user.try(:user_extensions).department.name.to_s : '' %> + <%= user.try(:user_extensions).school.name %><%= user.try(:user_extensions).department ? ' - '+user.try(:user_extensions).department.name.to_s : '' %> <% end %> <% if user.try(:user_extensions) && user.try(:user_extensions).identity %> <%= user.identity %> From b49c1f57527f3a62b86c6a84068cf456e4782d63 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 30 Apr 2019 11:21:51 +0800 Subject: [PATCH 07/10] 1 --- app/controllers/challenges_controller.rb | 4 +++- app/models/shixun.rb | 1 + app/views/challenges/_content_list.html.erb | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index df1da6ca..76f7b080 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -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] @@ -467,6 +467,8 @@ class ChallengesController < ApplicationController render_404 return else + logger.info("operable: ##{@shixun.operable?}") + logger.info("@shixun.status: ##{@shixun.status}") if (@shixun.status == 0 && !User.current.manager_of_shixun?(@shixun)) || (!@shixun.operable? && !User.current.admin?) render_403 return diff --git a/app/models/shixun.rb b/app/models/shixun.rb index c7d0460a..85b6a2d4 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -71,6 +71,7 @@ class Shixun < ActiveRecord::Base # 可供使用的实训 def operable? + logger.info("####") self.status != -1 && !self.hidden end diff --git a/app/views/challenges/_content_list.html.erb b/app/views/challenges/_content_list.html.erb index bc7743de..dec91671 100644 --- a/app/views/challenges/_content_list.html.erb +++ b/app/views/challenges/_content_list.html.erb @@ -13,7 +13,7 @@ <% end %>

    - +

    全部任务 From 731d8532e47d7d2f714de5c098a95599795ca300 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 30 Apr 2019 11:25:36 +0800 Subject: [PATCH 08/10] 1 --- app/controllers/challenges_controller.rb | 2 +- app/views/challenges/_content_list.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 76f7b080..344976ab 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -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] diff --git a/app/views/challenges/_content_list.html.erb b/app/views/challenges/_content_list.html.erb index dec91671..bc7743de 100644 --- a/app/views/challenges/_content_list.html.erb +++ b/app/views/challenges/_content_list.html.erb @@ -13,7 +13,7 @@ <% end %>

    - +

    全部任务 From 5f8341dcf5f8b65f8b094b248cd99730069afe36 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 30 Apr 2019 11:27:54 +0800 Subject: [PATCH 09/10] 1 --- app/models/shixun.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 85b6a2d4..439c0e44 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -55,8 +55,9 @@ class Shixun < ActiveRecord::Base scope :visible, lambda{where(status: [2,3])} - scope :min, lambda { select([:id, :name, :gpid, :modify_time, :reset_time, :language, :propaedeutics, :status, :identifier, :test_set_permission, :hide_code, :forbid_copy, - :webssh, :user_id, :code_hidden, :task_pass, :exec_time, :multi_webssh]) } + scope :min, lambda { select([:id, :name, :gpid, :modify_time, :reset_time, :language, :propaedeutics, :status, :identifier, + :test_set_permission, :hide_code, :forbid_copy, :hidden, :webssh, :user_id, :code_hidden, + :task_pass, :exec_time, :multi_webssh]) } scope :published, lambda{where(status: 2)} scope :field_for_recommend, lambda{ select([:id, :name, :identifier, :myshixuns_count]) } From 50d7ed2deb55a522f02451343d62995d91501c96 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 30 Apr 2019 11:34:45 +0800 Subject: [PATCH 10/10] export school statistic data feature --- Gemfile | 3 ++ .../managements/schools_controller.rb | 23 ++++++++++++- app/models/homework_common.rb | 32 ++++++------------- .../management/school_report_service.rb | 2 +- app/views/layouts/base_management.html.erb | 4 --- .../schools/_data_contrast_list.html.erb | 8 ++--- .../schools/_statistics_list.html.erb | 2 +- .../managements/schools/statistics.html.erb | 26 +++++++++++++++ .../schools/statistics_xlsx.xlsx.axlsx | 20 ++++++++++++ config/routes.rb | 1 + 10 files changed, 88 insertions(+), 33 deletions(-) create mode 100644 app/views/managements/schools/statistics_xlsx.xlsx.axlsx diff --git a/Gemfile b/Gemfile index b9e1b4e2..f4697bf5 100644 --- a/Gemfile +++ b/Gemfile @@ -62,6 +62,9 @@ gem 'elasticsearch-rails' gem 'oauth2' +# xlsx +gem 'axlsx_rails', '0.3.0' + #Ruby 2.2+ has removed test/unit from the core library. if RUBY_VERSION>='2.2' gem 'test-unit', '~> 3.0' diff --git a/app/controllers/managements/schools_controller.rb b/app/controllers/managements/schools_controller.rb index 6dfe84fb..381c7493 100644 --- a/app/controllers/managements/schools_controller.rb +++ b/app/controllers/managements/schools_controller.rb @@ -7,8 +7,13 @@ class Managements::SchoolsController < Managements::BaseController params[:sort_by] ||= :teacher_count params[:sort_direction] ||= :desc - schools = Management::SchoolReportService.new(params).call + schools = Management::SchoolReportService.new(params).call @schools = paginateHelper schools + + respond_to do |format| + format.html { load_statistic_total } + format.js + end end def yesterday_data @@ -31,6 +36,13 @@ class Managements::SchoolsController < Managements::BaseController raise '参数错误' end + def statistics_xlsx + @schools = Management::SchoolReportService.new(params).call + + filename = ["学校统计总表", params[:keyword], Time.zone.now.strftime('%Y%m%d%H%M%S')].join('-') << ".xlsx" + render xlsx: "statistics_xlsx", filename: filename + end + private def set_navigation_bar @menu_type = 1 @@ -41,4 +53,13 @@ class Managements::SchoolsController < Managements::BaseController [I18n.t("school_daily_report.#{column}"), column] end end + + def load_statistic_total + @teacher_total = User.teacher.count + @student_total = User.student.count + @course_total = Course.count + @active_course_total = Course.where(is_end: false).count + @shixun_homework_total = HomeworkCommon.where(homework_type: 4).count + @other_homework_total = HomeworkCommon.where(homework_type: [1, 3]).count + end end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 0b7aa420..abe09e08 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -63,33 +63,21 @@ class HomeworkCommon < ActiveRecord::Base #作业类型 def homework_type_ch - type = self.homework_type - case type - when 1 - type = "普通" - when 2 - type = "编程" - when 3 - type = "分组" - when 4 - type = "实训" + case homework_type + when 1 then '普通' + when 2 then '编程' + when 3 then '分组' + when 4 then '实训' end - type end def homework_type_module - type = self.homework_type - case type - when 1 - type = "common_homework" - when 2 - type = "code_homework" - when 3 - type = "group_homework" - when 4 - type = "shixun_homework" + case homework_type + when 1 then 'common_homework' + when 2 then 'code_homework' + when 3 then 'group_homework' + when 4 then 'shixun_homework' end - type end def act_as_activity diff --git a/app/services/management/school_report_service.rb b/app/services/management/school_report_service.rb index 5a962bd5..e9ee1bae 100644 --- a/app/services/management/school_report_service.rb +++ b/app/services/management/school_report_service.rb @@ -39,7 +39,7 @@ class Management::SchoolReportService ( SELECT COUNT(*) FROM homework_commons hc LEFT JOIN courses ON courses.id = hc.course_id - WHERE courses.school_id = schools.id + WHERE courses.school_id = schools.id AND hc.homework_type = 4 ) homework_count, ( SELECT COUNT(*) FROM homework_commons hc diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index 9d1d77c8..d357bd09 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -44,10 +44,6 @@

  • <%= link_to "课堂列表", classroom_classment_managements_path %>
  • <%= link_to "实训作业", shixun_task_managements_path%>
  • <%= link_to "项目列表", project_list_managements_path%>
  • - - - -
  • 精选实训+ diff --git a/app/views/managements/schools/_data_contrast_list.html.erb b/app/views/managements/schools/_data_contrast_list.html.erb index af63aee8..c2699601 100644 --- a/app/views/managements/schools/_data_contrast_list.html.erb +++ b/app/views/managements/schools/_data_contrast_list.html.erb @@ -35,20 +35,20 @@ percentage = report['total'].zero? ? increase.to_f * 100 : (increase / report['total'].to_f) * 100 %> <% if increase > 0 %> - + +<%= increase %> - +<%= percentage.round(5) %>% + +<%= percentage.round(5) %>% <% elsif increase.zero? %> <%= increase %> <%= percentage.round(5) %>% <% else %> - + <%= increase %> - <%= percentage.round(5) %>% + <%= percentage.round(5) %>% <% end %> <% end %> diff --git a/app/views/managements/schools/_statistics_list.html.erb b/app/views/managements/schools/_statistics_list.html.erb index 609a1cca..cffb316c 100644 --- a/app/views/managements/schools/_statistics_list.html.erb +++ b/app/views/managements/schools/_statistics_list.html.erb @@ -17,7 +17,7 @@ <% @schools.each_with_index do |school, index| %> - <% p school %><%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %> + <%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %> <%= school['id'] %> <%= school['name'] %> <%= school['teacher_count'] %> diff --git a/app/views/managements/schools/statistics.html.erb b/app/views/managements/schools/statistics.html.erb index 1597fe45..5a68f75c 100644 --- a/app/views/managements/schools/statistics.html.erb +++ b/app/views/managements/schools/statistics.html.erb @@ -4,7 +4,26 @@ class: 'fl task-form-30 task-height-30 mt10', style: 'margin: 10px 10px 10px 25px;' %> <%= link_to '搜索', 'javascript:void(0)', class: 'fl task-btn task-btn-orange ml5 mt10', onclick: "$('#school_report_search_form').submit();" %> <%= link_to '清除', 'javascript:clearSearchCondition()', class: 'fl task-btn ml5 mt2 mt10' %> + +
    + <%= link_to '导出Excel', school_statistics_xlsx_managements_path(format: :xlsx), + class: 'fl task-btn task-btn-orange mt10 mr20 export-statistic-btn', + onclick: 'exportSchoolStatistic();' %> +
    <% end %> + +
  • + +
    +
    + 统计总计: + 教师总人数<%= @teacher_total %>人, + 学生总人数<%= @student_total %>人, + 课堂总数<%= @course_total %>个, + 正在进行课堂总数<%= @active_course_total %>个, + 实训作业总数<%= @shixun_homework_total %>个, + 其它作业总数<%= @other_homework_total %>个, +
    @@ -16,4 +35,11 @@ $("#school_report_search_form input[name='keyword']").val(""); $('#school_report_search_form').submit(); } + + function exportSchoolStatistic(){ + var form = $("#school_report_search_form") + var exportLink = form.find(".export-statistic-btn"); + var keyword = form.find("input[name='keyword'").val(); + exportLink.attr("href", exportLink.attr("href") + "?keyword=" + keyword); + } \ No newline at end of file diff --git a/app/views/managements/schools/statistics_xlsx.xlsx.axlsx b/app/views/managements/schools/statistics_xlsx.xlsx.axlsx new file mode 100644 index 00000000..b68a817c --- /dev/null +++ b/app/views/managements/schools/statistics_xlsx.xlsx.axlsx @@ -0,0 +1,20 @@ +wb = xlsx_package.workbook +wb.add_worksheet(name: "统计总表") do |sheet| + sheet.add_row %w(ID 单位名称 教师总人数 学生总人数 课堂总数 正在进行课堂数 实训作业总数 其它作业总数 动态时间) + + total = @schools.count + buffer_size = 500 + times = total % 500 > 0 ? total / 500 + 1 : total / 500 + + times.times do |index| + schools = @schools.limit(buffer_size).offset(index * buffer_size) + + schools.each do |school| + sheet.add_row([ + school['id'].to_s, school['name'].to_s, school['teacher_count'].to_s, school['student_count'].to_s, + school['course_count'].to_s, school['active_course_count'].to_s, school['homework_count'].to_s, + school['other_homework_count'].to_s, format_time(school['nearly_course_time']) + ]) + end + end +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 26cddf96..85ec25c9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -728,6 +728,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 get :school_report, controller: 'managements::schools', action: 'statistics' get :school_yesterday_data, controller: 'managements::schools', action: 'yesterday_data' get :school_data_contrast, controller: 'managements::schools', action: 'data_contrast' + get :school_statistics_xlsx, controller: 'managements::schools', action: 'statistics_xlsx' end end # Enable Grack support