Browse Source

Merge branch 'pre_trustie_server' into trustie_server

pull/345/head
yystopf 2 years ago
parent
commit
8637dfb193
4 changed files with 7 additions and 4 deletions
  1. +1
    -1
      app/controllers/admins/projects_rank_controller.rb
  2. +1
    -0
      app/jobs/cache_async_clear_job.rb
  3. +2
    -2
      app/models/project.rb
  4. +3
    -1
      app/views/admins/projects_rank/shared/_data_list.html.erb

+ 1
- 1
app/controllers/admins/projects_rank_controller.rb View File

@@ -10,7 +10,7 @@ class Admins::ProjectsRankController < Admins::BaseController
sum(issues) as issues,
sum(pullrequests) as pullrequests,
sum(commits) as commits").includes(:project)
@statistics = @statistics.order("#{sort_by} #{sort_direction}")
@statistics = paginate @statistics.order("#{sort_by} #{sort_direction}")
export_excel(@statistics.limit(50))
end



+ 1
- 0
app/jobs/cache_async_clear_job.rb View File

@@ -2,6 +2,7 @@ class CacheAsyncClearJob < ApplicationJob
queue_as :cache

def perform(type, id=nil)
return if id.nil?
case type
when "project_common_service"
Cache::V2::ProjectCommonService.new(id).clear


+ 2
- 2
app/models/project.rb View File

@@ -181,14 +181,14 @@ class Project < ApplicationRecord
end
if changes[:is_public].present?
if changes[:is_public][0] && !changes[:is_public][1]
CacheAsyncClearJob.perform_later('project_rank_service', self.id)
CacheAsyncClearJob.set(wait: 5.seconds).perform_later('project_rank_service', self.id)
end
if !changes[:is_public][0] && changes[:is_public][1]
$redis_cache.srem("v2-project-rank-deleted", self.id)
end
end
if !self.common?
CacheAsyncClearJob.perform_later('project_rank_service', self.id)
CacheAsyncClearJob.set(wait: 5.seconds).perform_later('project_rank_service', self.id)
end
end



+ 3
- 1
app/views/admins/projects_rank/shared/_data_list.html.erb View File

@@ -34,4 +34,6 @@
</tr>
<% end %>
</tbody>
</table>
</table>

<%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %>

Loading…
Cancel
Save