Commit fd6dfbec authored by James Lopez's avatar James Lopez

refactor project registry

parent 83d9d9b4
...@@ -4,6 +4,8 @@ class Geo::ProjectRegistry < Geo::BaseRegistry ...@@ -4,6 +4,8 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
validates :project, presence: true, uniqueness: true validates :project, presence: true, uniqueness: true
scope :dirty, -> { where(arel_table[:resync_repository].eq(true).or(arel_table[:resync_wiki].eq(true))) } scope :dirty, -> { where(arel_table[:resync_repository].eq(true).or(arel_table[:resync_wiki].eq(true))) }
scope :failed_repos, -> { where(arel_table[:repository_retry_count].gt(0)) }
scope :failed_wikis, -> { where(arel_table[:wiki_retry_count].gt(0)) }
def self.failed def self.failed
repository_sync_failed = arel_table[:repository_retry_count].gt(0) repository_sync_failed = arel_table[:repository_retry_count].gt(0)
......
...@@ -164,6 +164,17 @@ class GeoNode < ActiveRecord::Base ...@@ -164,6 +164,17 @@ class GeoNode < ActiveRecord::Base
end end
end end
def project_registries_by(type: nil)
case type
when 'repository'
project_registries.failed_repos
when 'wiki'
project_registries.failed_repos
else
project_registries
end
end
def uploads def uploads
if restricted_project_ids if restricted_project_ids
uploads_table = Upload.arel_table uploads_table = Upload.arel_table
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment