From ed0655452c1a00611cd95fd162d732e2e8902f32 Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Mon, 11 Jul 2022 15:52:38 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=8Ewebhook=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E4=BB=93=E5=BA=93=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/commit_logs_controller.rb | 23 +++++++++++++++++++ app/models/commit_log.rb | 6 +++++ config/routes.rb | 2 ++ .../20220711061848_create_commit_logs.rb | 17 ++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 app/controllers/commit_logs_controller.rb create mode 100644 app/models/commit_log.rb create mode 100644 db/migrate/20220711061848_create_commit_logs.rb diff --git a/app/controllers/commit_logs_controller.rb b/app/controllers/commit_logs_controller.rb new file mode 100644 index 000000000..71eada879 --- /dev/null +++ b/app/controllers/commit_logs_controller.rb @@ -0,0 +1,23 @@ +class CommitLogsController < ApplicationController + + def create + tip_exception "未认证" unless params[:token].to_s == "7917908927b6f1b792f2027a08a8b24a2de42c1692c2fd45da0dee5cf90a5af5" + ref = params[:ref] + commit_id = params[:commits][0][:id] + message = params[:commits][0][:message] + user_name = params[:message][0][:committer][:username] + user_mail = params[:message][0][:committer][:email] + user = User.find_by(mail: user_mail) + user = User.find_by(login: user_name) if user.blank? + + repository_id = params[:repository][:id] + repository_name = params[:repository][:name] + repository_full_name = params[:repository][:full_name] + project = Project.where(identifier: repository_name).where(user_id: user.id)&.first + project = Project.where(identifier: repository_name).where(gpid: repository_id)&.first if project.blank? + CommitLog.create(user: user, project: project, repository_id: repository_id, + name: repository_name, full_name: repository_full_name, + ref: ref, commit_id: commit_id, message: message) + + end +end diff --git a/app/models/commit_log.rb b/app/models/commit_log.rb new file mode 100644 index 000000000..9b51b0631 --- /dev/null +++ b/app/models/commit_log.rb @@ -0,0 +1,6 @@ +class CommitLog < ApplicationRecord + belongs_to :user + belongs_to :project + belongs_to :repository + +end diff --git a/config/routes.rb b/config/routes.rb index 79b937b00..73e06ea53 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -973,6 +973,8 @@ Rails.application.routes.draw do get 'oauth/get_code', to: 'oauth#get_code' get 'oauth/get_token_callback', to: 'oauth#get_token_callback' + resources :commit_logs, :only => [:create] + root 'main#index' diff --git a/db/migrate/20220711061848_create_commit_logs.rb b/db/migrate/20220711061848_create_commit_logs.rb new file mode 100644 index 000000000..e0ef451af --- /dev/null +++ b/db/migrate/20220711061848_create_commit_logs.rb @@ -0,0 +1,17 @@ +class CreateCommitLogs < ActiveRecord::Migration[5.2] + def change + create_table :commit_logs do |t| + t.references :user + t.references :project + t.integer :repository_id + t.string :name + t.string :full_name + t.string :commit_id + t.string :ref + t.string :message + t.timestamps + end + + add_index :commit_logs, :commit_id + end +end From 5fcf789e63c544eabd364f6976e570489cd39d0c Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Thu, 14 Jul 2022 15:21:42 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fixed=20=E6=8F=90=E4=BA=A4=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=AE=B0=E5=BD=95=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?,=E4=BB=93=E5=BA=93=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/commit_logs_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/commit_logs_controller.rb b/app/controllers/commit_logs_controller.rb index 71eada879..1708b162b 100644 --- a/app/controllers/commit_logs_controller.rb +++ b/app/controllers/commit_logs_controller.rb @@ -13,7 +13,9 @@ class CommitLogsController < ApplicationController repository_id = params[:repository][:id] repository_name = params[:repository][:name] repository_full_name = params[:repository][:full_name] - project = Project.where(identifier: repository_name).where(user_id: user.id)&.first + owner_name = repository_full_name.split("/")[0] + owner = User.find_by(login: owner_name) + project = Project.where(identifier: repository_name).where(user_id: owner&.id)&.first project = Project.where(identifier: repository_name).where(gpid: repository_id)&.first if project.blank? CommitLog.create(user: user, project: project, repository_id: repository_id, name: repository_name, full_name: repository_full_name, From 8dae15225e0cc5263516238d071ec0474aca1b10 Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Mon, 11 Jul 2022 15:52:38 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 354 ++++++++++-------- .../admins/dashboards_controller.rb | 35 +- app/views/admins/dashboards/index.html.erb | 266 +++---------- 3 files changed, 272 insertions(+), 383 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e27c504aa..d675a0723 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,69 +1,69 @@ GEM remote: https://gems.ruby-china.com/ specs: - aasm (5.0.6) + aasm (5.2.0) concurrent-ruby (~> 1.0) - actioncable (5.2.4.1) - actionpack (= 5.2.4.1) + actioncable (5.2.6) + actionpack (= 5.2.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.1) - actionpack (= 5.2.4.1) - actionview (= 5.2.4.1) - activejob (= 5.2.4.1) + actionmailer (5.2.6) + actionpack (= 5.2.6) + actionview (= 5.2.6) + activejob (= 5.2.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4.1) - actionview (= 5.2.4.1) - activesupport (= 5.2.4.1) + actionpack (5.2.6) + actionview (= 5.2.6) + activesupport (= 5.2.6) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.1) - activesupport (= 5.2.4.1) + actionview (5.2.6) + activesupport (= 5.2.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_decorator (1.3.2) + active_decorator (1.4.0) activesupport - activejob (5.2.4.1) - activesupport (= 5.2.4.1) + activejob (5.2.6) + activesupport (= 5.2.6) globalid (>= 0.3.6) - activemodel (5.2.4.1) - activesupport (= 5.2.4.1) - activerecord (5.2.4.1) - activemodel (= 5.2.4.1) - activesupport (= 5.2.4.1) + activemodel (5.2.6) + activesupport (= 5.2.6) + activerecord (5.2.6) + activemodel (= 5.2.6) + activesupport (= 5.2.6) arel (>= 9.0) - activestorage (5.2.4.1) - actionpack (= 5.2.4.1) - activerecord (= 5.2.4.1) - marcel (~> 0.3.1) - activesupport (5.2.4.1) + activestorage (5.2.6) + actionpack (= 5.2.6) + activerecord (= 5.2.6) + marcel (~> 1.0.0) + activesupport (5.2.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) acts-as-taggable-on (6.5.0) activerecord (>= 5.0, < 6.1) - acts_as_list (0.9.19) - activerecord (>= 3.0) - addressable (2.7.0) + acts_as_list (1.0.4) + activerecord (>= 4.2) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) - ancestry (3.0.7) - activerecord (>= 3.2.0) - annotate (2.6.5) + ancestry (4.1.0) + activerecord (>= 5.2.6) + annotate (2.6.7) activerecord (>= 2.3.0) - rake (>= 0.8.7) + rake (~> 10.4.2, >= 10.4.2) archive-zip (0.12.0) io-like (~> 0.3.0) arel (9.0.0) - ast (2.4.0) - autoprefixer-rails (9.7.4) - execjs - awesome_print (1.8.0) + ast (2.4.2) + autoprefixer-rails (10.3.3.0) + execjs (~> 2) + awesome_print (1.9.2) axlsx (3.0.0.pre) htmlentities (~> 4.3, >= 4.3.4) mimemagic (~> 0.3) @@ -72,40 +72,43 @@ GEM axlsx_rails (0.5.2) actionpack (>= 3.1) axlsx (>= 2.0.1) - backport (1.1.2) - benchmark (0.1.0) + backport (1.2.0) + benchmark (0.2.0) bindex (0.8.1) - bootsnap (1.4.6) + bootsnap (1.9.3) msgpack (~> 1.0) bootstrap (4.3.1) autoprefixer-rails (>= 9.1.0) popper_js (>= 1.14.3, < 2) sassc-rails (>= 2.0.0) builder (3.2.4) - bulk_insert (1.7.0) + bulk_insert (1.9.0) activerecord (>= 3.2.0) - capybara (3.15.1) + capybara (3.36.0) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.2) + regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - chartkick (3.3.1) - childprocess (3.0.0) - chinese_pinyin (1.0.2) + chartkick (4.1.2) + childprocess (4.1.0) + chinese_pinyin (1.1.0) chromedriver-helper (2.1.1) archive-zip (~> 0.10) nokogiri (~> 1.8) - chunky_png (1.3.11) - concurrent-ruby (1.1.6) - connection_pool (2.2.2) + chunky_png (1.4.0) + concurrent-ruby (1.1.9) + connection_pool (2.2.5) crass (1.0.6) deep_cloneable (3.0.0) activerecord (>= 3.1.0, < 7) diff-lcs (1.3) diffy (3.3.0) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) doorkeeper (5.5.1) railties (>= 5) doorkeeper-jwt (0.4.1) @@ -119,93 +122,103 @@ GEM elasticsearch-transport (7.5.0) faraday (>= 0.14, < 1) multi_json - enumerize (2.3.1) + enumerize (2.4.0) activesupport (>= 3.2) - erubi (1.9.0) - et-orbi (1.2.4) + erubi (1.10.0) + et-orbi (1.2.6) tzinfo - execjs (2.7.0) + execjs (2.8.1) faraday (0.15.4) multipart-post (>= 1.2, < 3) - ffi (1.12.2) + ffi (1.15.4) font-awesome-sass (4.7.0) sass (>= 3.2) - fugit (1.4.1) + fugit (1.5.2) et-orbi (~> 1.1, >= 1.1.8) raabro (~> 1.4) - globalid (0.4.2) - activesupport (>= 4.2.0) + gitea-client (0.9.2) + rest-client (~> 2.1.0) + globalid (1.0.0) + activesupport (>= 5.0) grape-entity (0.7.1) activesupport (>= 4.0) multi_json (>= 1.3.2) groupdate (4.1.2) activesupport (>= 4.2) harmonious_dictionary (0.0.1) - hashie (3.6.0) + hashie (5.0.0) htmlentities (4.3.4) - i18n (1.8.2) + http-accept (1.7.0) + http-cookie (1.0.5) + domain_name (~> 0.5) + i18n (1.8.11) concurrent-ruby (~> 1.0) io-like (0.3.1) jaro_winkler (1.5.4) - jbuilder (2.10.0) + jbuilder (2.11.3) activesupport (>= 5.0.0) - jquery-rails (4.3.5) + jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - jwt (2.2.1) - kaminari (1.2.0) + jwt (2.3.0) + kaminari (1.2.1) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.0) - kaminari-activerecord (= 1.2.0) - kaminari-core (= 1.2.0) - kaminari-actionview (1.2.0) + kaminari-actionview (= 1.2.1) + kaminari-activerecord (= 1.2.1) + kaminari-core (= 1.2.1) + kaminari-actionview (1.2.1) actionview - kaminari-core (= 1.2.0) - kaminari-activerecord (1.2.0) + kaminari-core (= 1.2.1) + kaminari-activerecord (1.2.1) activerecord - kaminari-core (= 1.2.0) - kaminari-core (1.2.0) - letter_avatar (0.3.8) + kaminari-core (= 1.2.1) + kaminari-core (1.2.1) + letter_avatar (0.3.9) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.4.0) + loofah (2.13.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) + marcel (1.0.2) maruku (0.7.3) - method_source (0.9.2) - mimemagic (0.3.10) + matrix (0.4.2) + method_source (1.0.0) + mime-types (3.4.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2022.0105) + mimemagic (0.4.3) nokogiri (~> 1) rake - mini_mime (1.0.2) - mini_portile2 (2.4.0) - minitest (5.14.0) - msgpack (1.3.3) - multi_json (1.14.1) + mini_mime (1.1.2) + mini_portile2 (2.6.1) + minitest (5.14.4) + msgpack (1.4.2) + multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) mustermann (1.1.1) ruby2_keywords (~> 0.0.1) mysql2 (0.5.3) + netrc (0.11.0) nio4r (2.5.2) - nokogiri (1.10.8) - mini_portile2 (~> 2.4.0) - oauth2 (1.4.4) + nokogiri (1.12.5) + mini_portile2 (~> 2.6.1) + racc (~> 1.4) + oauth2 (1.4.7) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - omniauth (1.9.0) - hashie (>= 3.4.6, < 3.7.0) + omniauth (1.9.1) + hashie (>= 3.4.6) rack (>= 1.6.2, < 3) - omniauth-cas (1.1.1) + omniauth-cas (2.0.0) addressable (~> 2.3) nokogiri (~> 1.5) omniauth (~> 1.2) @@ -213,108 +226,112 @@ GEM oauth2 (~> 1.1) omniauth (~> 1.9) parallel (1.19.1) - parser (2.7.1.1) - ast (~> 2.4.0) + parser (2.7.2.0) + ast (~> 2.4.1) pdfkit (0.8.4.1) - polyamorous (2.3.2) - activerecord (>= 5.2.1) popper_js (1.16.0) - powerpack (0.1.2) - prettier (0.18.2) - public_suffix (4.0.3) - puma (3.12.2) + powerpack (0.1.3) + prettier (2.0.0) + public_suffix (4.0.6) + puma (3.12.6) raabro (1.4.0) - rack (2.0.9) + racc (1.6.0) + rack (2.2.3) rack-cors (1.1.1) rack (>= 2.0.0) - rack-mini-profiler (2.0.1) + rack-mini-profiler (2.3.3) rack (>= 1.2.0) - rack-protection (2.0.8.1) + rack-protection (2.1.0) rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.4.1) - actioncable (= 5.2.4.1) - actionmailer (= 5.2.4.1) - actionpack (= 5.2.4.1) - actionview (= 5.2.4.1) - activejob (= 5.2.4.1) - activemodel (= 5.2.4.1) - activerecord (= 5.2.4.1) - activestorage (= 5.2.4.1) - activesupport (= 5.2.4.1) + rails (5.2.6) + actioncable (= 5.2.6) + actionmailer (= 5.2.6) + actionpack (= 5.2.6) + actionview (= 5.2.6) + activejob (= 5.2.6) + activemodel (= 5.2.6) + activerecord (= 5.2.6) + activestorage (= 5.2.6) + activesupport (= 5.2.6) bundler (>= 1.3.0) - railties (= 5.2.4.1) + railties (= 5.2.6) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) + rails-html-sanitizer (1.4.2) loofah (~> 2.3) rails-i18n (5.1.3) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) - railties (5.2.4.1) - actionpack (= 5.2.4.1) - activesupport (= 5.2.4.1) + railties (5.2.6) + actionpack (= 5.2.6) + activesupport (= 5.2.6) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rainbow (3.0.0) - rake (13.0.1) - ransack (2.3.2) - activerecord (>= 5.2.1) - activesupport (>= 5.2.1) + rake (10.4.2) + ransack (2.4.2) + activerecord (>= 5.2.4) + activesupport (>= 5.2.4) i18n - polyamorous (= 2.3.2) - rb-fsevent (0.10.3) + rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) rchardet (1.8.0) - redcarpet (3.5.0) - redis (4.1.3) + redcarpet (3.5.1) + redis (4.5.1) redis-actionpack (5.2.0) actionpack (>= 5, < 7) redis-rack (>= 2.1.0, < 3) redis-store (>= 1.1.0, < 2) - redis-activesupport (5.2.0) + redis-activesupport (5.2.1) activesupport (>= 3, < 7) redis-store (>= 1.3, < 2) - redis-rack (2.1.2) + redis-rack (2.1.3) rack (>= 2.0.8, < 3) redis-store (>= 1.2, < 2) redis-rails (5.0.2) redis-actionpack (>= 5.0, < 6) redis-activesupport (>= 5.0, < 6) redis-store (>= 1.2, < 2) - redis-store (1.8.2) + redis-store (1.9.0) redis (>= 4, < 5) - regexp_parser (1.7.0) + regexp_parser (2.2.0) request_store (1.5.0) rack (>= 1.4) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) reverse_markdown (1.4.0) nokogiri + rexml (3.2.5) roo (2.8.3) nokogiri (~> 1) rubyzip (>= 1.3.0, < 3.0.0) roo-xls (1.2.0) nokogiri - roo (>= 2.0.0, < 3) + roo (= 2.8.3) spreadsheet (> 0.9.0) rqrcode (0.10.1) chunky_png (~> 1.0) rqrcode_png (0.1.5) chunky_png rqrcode - rspec-core (3.9.1) - rspec-support (~> 3.9.1) - rspec-expectations (3.9.0) + rspec-core (3.9.3) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) - rspec-rails (3.9.0) + rspec-rails (3.9.1) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -322,7 +339,7 @@ GEM rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) rspec-support (~> 3.9.0) - rspec-support (3.9.2) + rspec-support (3.9.4) rubocop (0.52.1) parallel (~> 1.10) parser (>= 2.4.0.2, < 3.0) @@ -331,8 +348,8 @@ GEM ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-ole (1.2.12.2) - ruby-progressbar (1.10.1) - ruby2_keywords (0.0.2) + ruby-progressbar (1.11.0) + ruby2_keywords (0.0.5) ruby_dep (1.5.0) rubyzip (1.3.0) sass (3.7.4) @@ -340,13 +357,13 @@ GEM sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) + sass-rails (5.1.0) + railties (>= 5.2.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sassc (2.2.1) + sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) @@ -354,31 +371,31 @@ GEM sprockets (> 3.0) sprockets-rails tilt - searchkick (3.1.3) - activemodel (>= 4.2) - elasticsearch (>= 5) + searchkick (4.6.3) + activemodel (>= 5) + elasticsearch (>= 6, < 7.14) hashie - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) + selenium-webdriver (4.1.0) + childprocess (>= 0.5, < 5.0) + rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2) - sidekiq (5.2.8) - connection_pool (~> 2.2, >= 2.2.2) - rack (< 2.1.0) - rack-protection (>= 1.5.0) - redis (>= 3.3.5, < 5) + sidekiq (6.3.1) + connection_pool (>= 2.2.2) + rack (~> 2.0) + redis (>= 4.2.0) sidekiq-cron (1.2.0) fugit (~> 1.1) sidekiq (>= 4.2.1) - simple_form (5.0.2) - actionpack (>= 5.0) - activemodel (>= 5.0) + simple_form (5.1.0) + actionpack (>= 5.2) + activemodel (>= 5.2) simple_xlsx_reader (1.0.4) nokogiri rubyzip - sinatra (2.0.8.1) + sinatra (2.1.0) mustermann (~> 1.0) - rack (~> 2.0) - rack-protection (= 2.0.8.1) + rack (~> 2.2) + rack-protection (= 2.1.0) tilt (~> 2.0) solargraph (0.38.6) backport (~> 1.1) @@ -394,43 +411,47 @@ GEM thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9) - spreadsheet (1.2.6) - ruby-ole (>= 1.0) - spring (2.0.2) - activesupport (>= 4.2) + spreadsheet (1.3.0) + ruby-ole + spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.1) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) - thor (1.0.1) + thor (1.1.0) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.6) + tzinfo (1.2.9) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (1.6.1) + unf (0.1.4) + unf_ext + unf_ext (0.0.8.2) + unicode-display_width (1.8.0) web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - websocket-driver (0.7.1) + webrick (1.7.0) + websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.4) - wkhtmltopdf-binary (0.12.5.4) + websocket-extensions (0.1.5) + wkhtmltopdf-binary (0.12.6.5) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.24) + yard (0.9.27) + webrick (~> 1.7.0) PLATFORMS ruby @@ -459,6 +480,7 @@ DEPENDENCIES enumerize faraday (~> 0.15.4) font-awesome-sass (= 4.7.0) + gitea-client (~> 0.9.1) grape-entity (~> 0.7.1) groupdate (~> 4.1.0) harmonious_dictionary (~> 0.0.1) diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index 3971971ff..0d88d0440 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -1,10 +1,33 @@ class Admins::DashboardsController < Admins::BaseController def index - @active_user_count = User.where(last_login_on: today).count - @weekly_active_user_count = User.where(last_login_on: current_week).count - @month_active_user_count = User.where(last_login_on: current_month).count + # 用户活跃数 + day_user_ids = CommitLog.where(created_at: today).pluck(:project_id).uniq + weekly_user_ids = CommitLog.where(created_at: current_week).pluck(:project_id).uniq + month_user_ids = CommitLog.where(created_at: current_month).pluck(:project_id).uniq + @active_user_count = User.where(last_login_on: today).or(User.where(id: day_user_ids)).count + @weekly_active_user_count = User.where(last_login_on: current_week).or(User.where(id: weekly_user_ids)).count + @month_active_user_count = User.where(last_login_on: current_month).or(User.where(id: month_user_ids)).count + user_ids = User.where(created_on: pre_week).pluck(:id).uniq + weekly_keep_user_count = User.where(id: user_ids).where(last_login_on: current_week).count + @weekly_keep_rate = format("%.2f", weekly_keep_user_count > 0 ? weekly_keep_user_count / weekly_keep_user_count : 0) - @new_user_count = User.where(created_on: current_month).count + # 新用户注册数 + @day_new_user_count = User.where(created_on: today).count + @weekly_new_user_count = User.where(created_on: current_week).count + @month_new_user_count = User.where(created_on: current_month).count + + # 活跃项目数 + day_project_ids = CommitLog.where(created_at: today).pluck(:project_id).uniq + weekly_project_ids = CommitLog.where(created_at: current_week).pluck(:project_id).uniq + month_project_ids = CommitLog.where(created_at: current_month).pluck(:project_id).uniq + @day_active_project_count = Project.where(updated_on: today).or(Project.where(id: day_project_ids)).count + @weekly_active_project_count = Project.where(updated_on: current_week).or(Project.where(id: weekly_project_ids)).count + @month_active_project_count = Project.where(updated_on: current_month).or(Project.where(id: month_project_ids)).count + + # 新增项目数 + @day_new_project_count = User.where(created_on: today).count + @weekly_new_project_count = User.where(created_on: current_week).count + @month_new_project_count = User.where(created_on: current_month).count end def month_active_user @@ -48,4 +71,8 @@ class Admins::DashboardsController < Admins::BaseController def current_month 30.days.ago.beginning_of_day..Time.now.end_of_day end + + def pre_week + 14.days.ago.beginning_of_day..7.days.ago.beginning_of_day + end end \ No newline at end of file diff --git a/app/views/admins/dashboards/index.html.erb b/app/views/admins/dashboards/index.html.erb index e02c307a5..649c00904 100644 --- a/app/views/admins/dashboards/index.html.erb +++ b/app/views/admins/dashboards/index.html.erb @@ -2,217 +2,57 @@ <% add_admin_breadcrumb('概览', admins_path) %> <% end %> -
-
-
- -
-
-
-
-
-
-
当日活跃用户
- <%= @active_user_count %> -
-
-
- -
-
-
- - - - -
-
-
-
-
-
-
-
-
7天内活跃用户数
- <%= @weekly_active_user_count %> -
-
-
- -
-
-
- - - - -
-
-
-
-
-
-
-
-
30天内活跃用户数
- <%= @month_active_user_count %> -
-
-
- -
-
-
- - - - -
-
-
-
-
-
-
-
-
30天内新增用户数
- <%= @new_user_count %> -
-
-
- -
-
-
- - - - -
-
-
-
-
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
指标名称当日数七日内30日内周用户留存率
+ + <%=@active_user_count %><%=@weekly_active_user_count %><%=@month_active_user_count %><%="#{@weekly_keep_rate.to_f * 100 }%" %>
+ + <%=@day_new_user_count %><%=@weekly_new_user_count %><%=@month_new_user_count %><%="--" %>
+ + <%=@day_active_project_count %><%=@weekly_new_project_count %><%=@month_new_project_count %><%="--" %>
+ + <%=@day_new_project_count %><%=@weekly_new_user_count %><%=@month_new_user_count %><%="--" %>
- -
-
-
-
- - - - - - - - -
-
- -
-
-
-
-
30天内新增用户
-
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - <%# 5.times do %> - - - - - - - - - <%# end %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - <%# 5.times do %> - - - - - - - - - - - - - - - - - - - <%# end %> - - - - - - - \ No newline at end of file +
+
\ No newline at end of file From df7b91a8ba19fb09f7c0b2dc0871ad7acfe110b8 Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Mon, 18 Jul 2022 10:38:45 +0800 Subject: [PATCH 4/9] gemfile.lock reset --- Gemfile.lock | 354 ++++++++++++++++++++++++--------------------------- 1 file changed, 166 insertions(+), 188 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d675a0723..e27c504aa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,69 +1,69 @@ GEM remote: https://gems.ruby-china.com/ specs: - aasm (5.2.0) + aasm (5.0.6) concurrent-ruby (~> 1.0) - actioncable (5.2.6) - actionpack (= 5.2.6) + actioncable (5.2.4.1) + actionpack (= 5.2.4.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.6) - actionpack (= 5.2.6) - actionview (= 5.2.6) - activejob (= 5.2.6) + actionmailer (5.2.4.1) + actionpack (= 5.2.4.1) + actionview (= 5.2.4.1) + activejob (= 5.2.4.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.6) - actionview (= 5.2.6) - activesupport (= 5.2.6) + actionpack (5.2.4.1) + actionview (= 5.2.4.1) + activesupport (= 5.2.4.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.6) - activesupport (= 5.2.6) + actionview (5.2.4.1) + activesupport (= 5.2.4.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_decorator (1.4.0) + active_decorator (1.3.2) activesupport - activejob (5.2.6) - activesupport (= 5.2.6) + activejob (5.2.4.1) + activesupport (= 5.2.4.1) globalid (>= 0.3.6) - activemodel (5.2.6) - activesupport (= 5.2.6) - activerecord (5.2.6) - activemodel (= 5.2.6) - activesupport (= 5.2.6) + activemodel (5.2.4.1) + activesupport (= 5.2.4.1) + activerecord (5.2.4.1) + activemodel (= 5.2.4.1) + activesupport (= 5.2.4.1) arel (>= 9.0) - activestorage (5.2.6) - actionpack (= 5.2.6) - activerecord (= 5.2.6) - marcel (~> 1.0.0) - activesupport (5.2.6) + activestorage (5.2.4.1) + actionpack (= 5.2.4.1) + activerecord (= 5.2.4.1) + marcel (~> 0.3.1) + activesupport (5.2.4.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) acts-as-taggable-on (6.5.0) activerecord (>= 5.0, < 6.1) - acts_as_list (1.0.4) - activerecord (>= 4.2) - addressable (2.8.0) + acts_as_list (0.9.19) + activerecord (>= 3.0) + addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - ancestry (4.1.0) - activerecord (>= 5.2.6) - annotate (2.6.7) + ancestry (3.0.7) + activerecord (>= 3.2.0) + annotate (2.6.5) activerecord (>= 2.3.0) - rake (~> 10.4.2, >= 10.4.2) + rake (>= 0.8.7) archive-zip (0.12.0) io-like (~> 0.3.0) arel (9.0.0) - ast (2.4.2) - autoprefixer-rails (10.3.3.0) - execjs (~> 2) - awesome_print (1.9.2) + ast (2.4.0) + autoprefixer-rails (9.7.4) + execjs + awesome_print (1.8.0) axlsx (3.0.0.pre) htmlentities (~> 4.3, >= 4.3.4) mimemagic (~> 0.3) @@ -72,43 +72,40 @@ GEM axlsx_rails (0.5.2) actionpack (>= 3.1) axlsx (>= 2.0.1) - backport (1.2.0) - benchmark (0.2.0) + backport (1.1.2) + benchmark (0.1.0) bindex (0.8.1) - bootsnap (1.9.3) + bootsnap (1.4.6) msgpack (~> 1.0) bootstrap (4.3.1) autoprefixer-rails (>= 9.1.0) popper_js (>= 1.14.3, < 2) sassc-rails (>= 2.0.0) builder (3.2.4) - bulk_insert (1.9.0) + bulk_insert (1.7.0) activerecord (>= 3.2.0) - capybara (3.36.0) + capybara (3.15.1) addressable - matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (>= 1.5, < 3.0) + regexp_parser (~> 1.2) xpath (~> 3.2) - chartkick (4.1.2) - childprocess (4.1.0) - chinese_pinyin (1.1.0) + chartkick (3.3.1) + childprocess (3.0.0) + chinese_pinyin (1.0.2) chromedriver-helper (2.1.1) archive-zip (~> 0.10) nokogiri (~> 1.8) - chunky_png (1.4.0) - concurrent-ruby (1.1.9) - connection_pool (2.2.5) + chunky_png (1.3.11) + concurrent-ruby (1.1.6) + connection_pool (2.2.2) crass (1.0.6) deep_cloneable (3.0.0) activerecord (>= 3.1.0, < 7) diff-lcs (1.3) diffy (3.3.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) doorkeeper (5.5.1) railties (>= 5) doorkeeper-jwt (0.4.1) @@ -122,103 +119,93 @@ GEM elasticsearch-transport (7.5.0) faraday (>= 0.14, < 1) multi_json - enumerize (2.4.0) + enumerize (2.3.1) activesupport (>= 3.2) - erubi (1.10.0) - et-orbi (1.2.6) + erubi (1.9.0) + et-orbi (1.2.4) tzinfo - execjs (2.8.1) + execjs (2.7.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) - ffi (1.15.4) + ffi (1.12.2) font-awesome-sass (4.7.0) sass (>= 3.2) - fugit (1.5.2) + fugit (1.4.1) et-orbi (~> 1.1, >= 1.1.8) raabro (~> 1.4) - gitea-client (0.9.2) - rest-client (~> 2.1.0) - globalid (1.0.0) - activesupport (>= 5.0) + globalid (0.4.2) + activesupport (>= 4.2.0) grape-entity (0.7.1) activesupport (>= 4.0) multi_json (>= 1.3.2) groupdate (4.1.2) activesupport (>= 4.2) harmonious_dictionary (0.0.1) - hashie (5.0.0) + hashie (3.6.0) htmlentities (4.3.4) - http-accept (1.7.0) - http-cookie (1.0.5) - domain_name (~> 0.5) - i18n (1.8.11) + i18n (1.8.2) concurrent-ruby (~> 1.0) io-like (0.3.1) jaro_winkler (1.5.4) - jbuilder (2.11.3) + jbuilder (2.10.0) activesupport (>= 5.0.0) - jquery-rails (4.4.0) + jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - jwt (2.3.0) - kaminari (1.2.1) + jwt (2.2.1) + kaminari (1.2.0) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.1) - kaminari-activerecord (= 1.2.1) - kaminari-core (= 1.2.1) - kaminari-actionview (1.2.1) + kaminari-actionview (= 1.2.0) + kaminari-activerecord (= 1.2.0) + kaminari-core (= 1.2.0) + kaminari-actionview (1.2.0) actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) + kaminari-core (= 1.2.0) + kaminari-activerecord (1.2.0) activerecord - kaminari-core (= 1.2.1) - kaminari-core (1.2.1) - letter_avatar (0.3.9) + kaminari-core (= 1.2.0) + kaminari-core (1.2.0) + letter_avatar (0.3.8) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.13.0) + loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (1.0.2) + marcel (0.3.3) + mimemagic (~> 0.3.2) maruku (0.7.3) - matrix (0.4.2) - method_source (1.0.0) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) - mimemagic (0.4.3) + method_source (0.9.2) + mimemagic (0.3.10) nokogiri (~> 1) rake - mini_mime (1.1.2) - mini_portile2 (2.6.1) - minitest (5.14.4) - msgpack (1.4.2) - multi_json (1.15.0) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.14.0) + msgpack (1.3.3) + multi_json (1.14.1) multi_xml (0.6.0) multipart-post (2.1.1) mustermann (1.1.1) ruby2_keywords (~> 0.0.1) mysql2 (0.5.3) - netrc (0.11.0) nio4r (2.5.2) - nokogiri (1.12.5) - mini_portile2 (~> 2.6.1) - racc (~> 1.4) - oauth2 (1.4.7) + nokogiri (1.10.8) + mini_portile2 (~> 2.4.0) + oauth2 (1.4.4) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - omniauth (1.9.1) - hashie (>= 3.4.6) + omniauth (1.9.0) + hashie (>= 3.4.6, < 3.7.0) rack (>= 1.6.2, < 3) - omniauth-cas (2.0.0) + omniauth-cas (1.1.1) addressable (~> 2.3) nokogiri (~> 1.5) omniauth (~> 1.2) @@ -226,112 +213,108 @@ GEM oauth2 (~> 1.1) omniauth (~> 1.9) parallel (1.19.1) - parser (2.7.2.0) - ast (~> 2.4.1) + parser (2.7.1.1) + ast (~> 2.4.0) pdfkit (0.8.4.1) + polyamorous (2.3.2) + activerecord (>= 5.2.1) popper_js (1.16.0) - powerpack (0.1.3) - prettier (2.0.0) - public_suffix (4.0.6) - puma (3.12.6) + powerpack (0.1.2) + prettier (0.18.2) + public_suffix (4.0.3) + puma (3.12.2) raabro (1.4.0) - racc (1.6.0) - rack (2.2.3) + rack (2.0.9) rack-cors (1.1.1) rack (>= 2.0.0) - rack-mini-profiler (2.3.3) + rack-mini-profiler (2.0.1) rack (>= 1.2.0) - rack-protection (2.1.0) + rack-protection (2.0.8.1) rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.6) - actioncable (= 5.2.6) - actionmailer (= 5.2.6) - actionpack (= 5.2.6) - actionview (= 5.2.6) - activejob (= 5.2.6) - activemodel (= 5.2.6) - activerecord (= 5.2.6) - activestorage (= 5.2.6) - activesupport (= 5.2.6) + rails (5.2.4.1) + actioncable (= 5.2.4.1) + actionmailer (= 5.2.4.1) + actionpack (= 5.2.4.1) + actionview (= 5.2.4.1) + activejob (= 5.2.4.1) + activemodel (= 5.2.4.1) + activerecord (= 5.2.4.1) + activestorage (= 5.2.4.1) + activesupport (= 5.2.4.1) bundler (>= 1.3.0) - railties (= 5.2.6) + railties (= 5.2.4.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) + rails-html-sanitizer (1.3.0) loofah (~> 2.3) rails-i18n (5.1.3) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) - railties (5.2.6) - actionpack (= 5.2.6) - activesupport (= 5.2.6) + railties (5.2.4.1) + actionpack (= 5.2.4.1) + activesupport (= 5.2.4.1) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rainbow (3.0.0) - rake (10.4.2) - ransack (2.4.2) - activerecord (>= 5.2.4) - activesupport (>= 5.2.4) + rake (13.0.1) + ransack (2.3.2) + activerecord (>= 5.2.1) + activesupport (>= 5.2.1) i18n - rb-fsevent (0.11.0) + polyamorous (= 2.3.2) + rb-fsevent (0.10.3) rb-inotify (0.10.1) ffi (~> 1.0) rchardet (1.8.0) - redcarpet (3.5.1) - redis (4.5.1) + redcarpet (3.5.0) + redis (4.1.3) redis-actionpack (5.2.0) actionpack (>= 5, < 7) redis-rack (>= 2.1.0, < 3) redis-store (>= 1.1.0, < 2) - redis-activesupport (5.2.1) + redis-activesupport (5.2.0) activesupport (>= 3, < 7) redis-store (>= 1.3, < 2) - redis-rack (2.1.3) + redis-rack (2.1.2) rack (>= 2.0.8, < 3) redis-store (>= 1.2, < 2) redis-rails (5.0.2) redis-actionpack (>= 5.0, < 6) redis-activesupport (>= 5.0, < 6) redis-store (>= 1.2, < 2) - redis-store (1.9.0) + redis-store (1.8.2) redis (>= 4, < 5) - regexp_parser (2.2.0) + regexp_parser (1.7.0) request_store (1.5.0) rack (>= 1.4) - rest-client (2.1.0) - http-accept (>= 1.7.0, < 2.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 4.0) - netrc (~> 0.8) reverse_markdown (1.4.0) nokogiri - rexml (3.2.5) roo (2.8.3) nokogiri (~> 1) rubyzip (>= 1.3.0, < 3.0.0) roo-xls (1.2.0) nokogiri - roo (= 2.8.3) + roo (>= 2.0.0, < 3) spreadsheet (> 0.9.0) rqrcode (0.10.1) chunky_png (~> 1.0) rqrcode_png (0.1.5) chunky_png rqrcode - rspec-core (3.9.3) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.4) + rspec-core (3.9.1) + rspec-support (~> 3.9.1) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) - rspec-rails (3.9.1) + rspec-rails (3.9.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -339,7 +322,7 @@ GEM rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) rspec-support (~> 3.9.0) - rspec-support (3.9.4) + rspec-support (3.9.2) rubocop (0.52.1) parallel (~> 1.10) parser (>= 2.4.0.2, < 3.0) @@ -348,8 +331,8 @@ GEM ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-ole (1.2.12.2) - ruby-progressbar (1.11.0) - ruby2_keywords (0.0.5) + ruby-progressbar (1.10.1) + ruby2_keywords (0.0.2) ruby_dep (1.5.0) rubyzip (1.3.0) sass (3.7.4) @@ -357,13 +340,13 @@ GEM sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.1.0) - railties (>= 5.2.0) + sass-rails (5.0.7) + railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sassc (2.4.0) + sassc (2.2.1) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) @@ -371,31 +354,31 @@ GEM sprockets (> 3.0) sprockets-rails tilt - searchkick (4.6.3) - activemodel (>= 5) - elasticsearch (>= 6, < 7.14) + searchkick (3.1.3) + activemodel (>= 4.2) + elasticsearch (>= 5) hashie - selenium-webdriver (4.1.0) - childprocess (>= 0.5, < 5.0) - rexml (~> 3.2, >= 3.2.5) + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - sidekiq (6.3.1) - connection_pool (>= 2.2.2) - rack (~> 2.0) - redis (>= 4.2.0) + sidekiq (5.2.8) + connection_pool (~> 2.2, >= 2.2.2) + rack (< 2.1.0) + rack-protection (>= 1.5.0) + redis (>= 3.3.5, < 5) sidekiq-cron (1.2.0) fugit (~> 1.1) sidekiq (>= 4.2.1) - simple_form (5.1.0) - actionpack (>= 5.2) - activemodel (>= 5.2) + simple_form (5.0.2) + actionpack (>= 5.0) + activemodel (>= 5.0) simple_xlsx_reader (1.0.4) nokogiri rubyzip - sinatra (2.1.0) + sinatra (2.0.8.1) mustermann (~> 1.0) - rack (~> 2.2) - rack-protection (= 2.1.0) + rack (~> 2.0) + rack-protection (= 2.0.8.1) tilt (~> 2.0) solargraph (0.38.6) backport (~> 1.1) @@ -411,47 +394,43 @@ GEM thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9) - spreadsheet (1.3.0) - ruby-ole - spring (2.1.1) + spreadsheet (1.2.6) + ruby-ole (>= 1.0) + spring (2.0.2) + activesupport (>= 4.2) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) sprockets (>= 3.0.0) - thor (1.1.0) + thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.9) + tzinfo (1.2.6) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) - unicode-display_width (1.8.0) + unicode-display_width (1.6.1) web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - webrick (1.7.0) - websocket-driver (0.7.5) + websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - wkhtmltopdf-binary (0.12.6.5) + websocket-extensions (0.1.4) + wkhtmltopdf-binary (0.12.5.4) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.27) - webrick (~> 1.7.0) + yard (0.9.24) PLATFORMS ruby @@ -480,7 +459,6 @@ DEPENDENCIES enumerize faraday (~> 0.15.4) font-awesome-sass (= 4.7.0) - gitea-client (~> 0.9.1) grape-entity (~> 0.7.1) groupdate (~> 4.1.0) harmonious_dictionary (~> 0.0.1) From b5dfd83527a6113bfea2e134bdd540775cbc5d31 Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Mon, 18 Jul 2022 10:43:57 +0800 Subject: [PATCH 5/9] =?UTF-8?q?fix=20=E6=8F=90=E4=BA=A4=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E4=B8=8D?= =?UTF-8?q?=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/commit_logs_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/commit_logs_controller.rb b/app/controllers/commit_logs_controller.rb index 1708b162b..c02d199b0 100644 --- a/app/controllers/commit_logs_controller.rb +++ b/app/controllers/commit_logs_controller.rb @@ -5,8 +5,8 @@ class CommitLogsController < ApplicationController ref = params[:ref] commit_id = params[:commits][0][:id] message = params[:commits][0][:message] - user_name = params[:message][0][:committer][:username] - user_mail = params[:message][0][:committer][:email] + user_name = params[:pusher][:login] + user_mail = params[:pusher][:email] user = User.find_by(mail: user_mail) user = User.find_by(login: user_name) if user.blank? From d9a1d32ec8b63759d0e12d9a9706d514794e4a03 Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Mon, 18 Jul 2022 10:55:41 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fixed=20=E5=90=8E=E5=8F=B0=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=BC=98=E5=8C=96,=E5=91=A8=E5=AD=98=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/dashboards_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index 0d88d0440..3d86f161d 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -9,7 +9,7 @@ class Admins::DashboardsController < Admins::BaseController @month_active_user_count = User.where(last_login_on: current_month).or(User.where(id: month_user_ids)).count user_ids = User.where(created_on: pre_week).pluck(:id).uniq weekly_keep_user_count = User.where(id: user_ids).where(last_login_on: current_week).count - @weekly_keep_rate = format("%.2f", weekly_keep_user_count > 0 ? weekly_keep_user_count / weekly_keep_user_count : 0) + @weekly_keep_rate = format("%.2f", user_ids.size > 0 ? weekly_keep_user_count / user_ids.size : 0) # 新用户注册数 @day_new_user_count = User.where(created_on: today).count From d9653e461eaa556b5f4646ee453fe9754c8e6989 Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Mon, 18 Jul 2022 11:00:47 +0800 Subject: [PATCH 7/9] =?UTF-8?q?fixed=20=E5=90=8E=E5=8F=B0=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=BC=98=E5=8C=96,=E5=91=A8=E5=AD=98=E7=8E=87?= =?UTF-8?q?=E5=B0=8F=E6=95=B0=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/dashboards_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index 3d86f161d..d9e25c664 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -9,7 +9,7 @@ class Admins::DashboardsController < Admins::BaseController @month_active_user_count = User.where(last_login_on: current_month).or(User.where(id: month_user_ids)).count user_ids = User.where(created_on: pre_week).pluck(:id).uniq weekly_keep_user_count = User.where(id: user_ids).where(last_login_on: current_week).count - @weekly_keep_rate = format("%.2f", user_ids.size > 0 ? weekly_keep_user_count / user_ids.size : 0) + @weekly_keep_rate = format("%.2f", user_ids.size > 0 ? weekly_keep_user_count.to_f / user_ids.size : 0) # 新用户注册数 @day_new_user_count = User.where(created_on: today).count From 3580a8653d0b80e56526357aa17b1f2972a1a24f Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Mon, 18 Jul 2022 11:04:57 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fixed=20=E5=90=8E=E5=8F=B0=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=BC=98=E5=8C=96,=E6=96=B0=E5=A2=9E=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/dashboards_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index d9e25c664..5ac1508d1 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -25,9 +25,9 @@ class Admins::DashboardsController < Admins::BaseController @month_active_project_count = Project.where(updated_on: current_month).or(Project.where(id: month_project_ids)).count # 新增项目数 - @day_new_project_count = User.where(created_on: today).count - @weekly_new_project_count = User.where(created_on: current_week).count - @month_new_project_count = User.where(created_on: current_month).count + @day_new_project_count = Project.where(created_on: today).count + @weekly_new_project_count = Project.where(created_on: current_week).count + @month_new_project_count = Project.where(created_on: current_month).count end def month_active_user From 04b9e433826a8e19cb5874ed6fb32a95cf274886 Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Mon, 18 Jul 2022 11:14:45 +0800 Subject: [PATCH 9/9] =?UTF-8?q?fixed=20=E5=90=8E=E5=8F=B0=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=BC=98=E5=8C=96,=E6=96=B0=E5=A2=9E=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admins/dashboards/index.html.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/admins/dashboards/index.html.erb b/app/views/admins/dashboards/index.html.erb index 649c00904..2d86b4b6c 100644 --- a/app/views/admins/dashboards/index.html.erb +++ b/app/views/admins/dashboards/index.html.erb @@ -38,17 +38,17 @@ <%=@day_active_project_count %> - <%=@weekly_new_project_count %> - <%=@month_new_project_count %> + <%=@weekly_active_project_count %> + <%=@month_active_project_count %> <%="--" %> - + <%=@day_new_project_count %> - <%=@weekly_new_user_count %> - <%=@month_new_user_count %> + <%=@weekly_new_project_count %> + <%=@month_new_project_count %> <%="--" %>