Browse Source

统计提交数到db,调整

pull/330/head
xxq250 3 years ago
parent
commit
a4e26065b4
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      lib/tasks/total_commit_to_db.rake

+ 6
- 3
lib/tasks/total_commit_to_db.rake View File

@@ -3,10 +3,13 @@ namespace :total_commit_to_db do
task done: :environment do
project_name = ENV['name'] || "mindspore"
puts "project_id=================#{project_name}"
projects = Project.where(identifier: ['MindSpore-first-experience', ' MindSpore-install', 'MindSpore-Application-practice', 'MindSpore-Model-Development', 'MindSpore-Data-preprocessing', 'Mindspore-Data-storage-use', 'MindSpore-Data-storage-kunpeng', 'MindSpore-LeNet-jzx3', 'MindSpore-competition'] )

if ENV['project_id'].present?
projects = Project.where(id: ENV['project_id'])
else
projects = Project.where(identifier: ['MindSpore-first-experience', ' MindSpore-install', 'MindSpore-Application-practice', 'MindSpore-Model-Development', 'MindSpore-Data-preprocessing', 'Mindspore-Data-storage-use', 'MindSpore-Data-storage-kunpeng', 'MindSpore-LeNet-jzx3', 'MindSpore-competition'] )
end
projects.each_with_index do |project, index|
result = Gitea::Repository::Commits::ListService.call(project.owner.login,project.identifier,sha: "", page: 1, limit: 5, token: project.owner.gitea_token)
result = Gitea::Repository::Commits::ListService.call(project.owner.login,project.identifier,sha: "", page: 1, limit: 200, token: project.owner.gitea_token)
next if result.blank? || result[:total_count].blank?
total_count = result[:total_count]
# next if total_count > 2000


Loading…
Cancel
Save