diff --git a/Procfile b/Procfile
new file mode 100644
index 000000000..3fd9f6fd1
--- /dev/null
+++ b/Procfile
@@ -0,0 +1,2 @@
+web: cd client && npm start
+api: bundle exec rails s -p 3001
diff --git a/app/models/sta_all.rb b/app/models/sta_all.rb
new file mode 100644
index 000000000..e9d64b368
--- /dev/null
+++ b/app/models/sta_all.rb
@@ -0,0 +1,20 @@
+class StaAll < ApplicationRecord
+ # t.integer :school_id 学校ID
+ # t.integer :tea_count 老师数
+ # t.integer :stu_count 学生数
+ # t.integer :active_users_count 活跃用户数(3个月内有登录)
+ # t.integer :courses_count 总课堂数
+ # t.integer :curr_courses_count 正在进行的课堂数
+ # t.integer :homw_shixuns_count 实训作业数
+ # t.integer :homw_other_count 其它类型作业数
+ # t.integer :sources_count 资源数
+ # t.integer :videos_count 视频总个数
+ # t.integer :shixuns_count 制作实训总数
+ # t.integer :myshixuns_count 挑战实训总数
+ # t.integer :mys_passed_count 通关的实训总数
+ # t.integer :games_count 挑战的总关卡数
+ # t.integer :games_passed_count 通关的总关卡数
+ # t.integer :build_count 评测总数
+
+ belongs_to :school
+end
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 6982891ee..2463b45ad 100644
--- a/app/views/admins/daily_school_statistics/shared/_list.html.erb
+++ b/app/views/admins/daily_school_statistics/shared/_list.html.erb
@@ -11,7 +11,7 @@
<%= sort_tag(name: 'shixun_evaluate_count', path: admins_daily_school_statistics_path) do %>
实训评测总数
-
+
<% end %>
|
<%= sort_tag('实训作业总数', name: 'homework_count', path: admins_daily_school_statistics_path) %> |
diff --git a/db/migrate/20200305121450_create_sta_alls.rb b/db/migrate/20200305121450_create_sta_alls.rb
new file mode 100644
index 000000000..663094400
--- /dev/null
+++ b/db/migrate/20200305121450_create_sta_alls.rb
@@ -0,0 +1,25 @@
+class CreateStaAlls < ActiveRecord::Migration[5.2]
+ def change
+ create_table :sta_alls do |t|
+ t.integer :school_id, default: 0
+ t.integer :tea_count, default: 0
+ t.integer :stu_count, default: 0
+ t.integer :active_users_count, default: 0
+ t.integer :courses_count, default: 0
+ t.integer :curr_courses_count, default: 0
+ t.integer :homw_shixuns_count, default: 0
+ t.integer :homw_other_count, default: 0
+ t.integer :sources_count, default: 0
+ t.integer :videos_count, default: 0
+ t.integer :shixuns_count, default: 0
+ t.integer :myshixuns_count, default: 0
+ t.integer :mys_passed_count, default: 0
+ t.integer :games_count, default: 0
+ t.integer :games_passed_count, default: 0
+ t.integer :build_count, default: 0
+
+
+ t.timestamps
+ end
+ end
+end
diff --git a/lib/tasks/static_all.rake b/lib/tasks/static_all.rake
new file mode 100644
index 000000000..4c878841e
--- /dev/null
+++ b/lib/tasks/static_all.rake
@@ -0,0 +1,16 @@
+desc "统计每个学校使用数据"
+
+namespace :static_all do
+ task :repo => :environment do
+ School.find_each(batch_size: 100) do |school|
+ User.joins(:user_extension).where(school_id: school.id)
+
+
+ report = StaAll.find_or_initialize_by(school_id: school.id)
+
+ report.shixun_evaluate_count = evaluate_count
+
+ report.save
+ end
+ end
+end
\ No newline at end of file
diff --git a/spec/models/sta_all_spec.rb b/spec/models/sta_all_spec.rb
new file mode 100644
index 000000000..b02d7e612
--- /dev/null
+++ b/spec/models/sta_all_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe StaAll, type: :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end