Extract repositories method on GeoNodeStatus model

parent 840fb8ab
...@@ -15,12 +15,7 @@ class GeoNodeStatus ...@@ -15,12 +15,7 @@ class GeoNodeStatus
end end
def repositories_count def repositories_count
@repositories_count ||= @repositories_count ||= repositories.count
if restricted_project_ids
Project.where(id: restricted_project_ids).count
else
Project.count
end
end end
def repositories_count=(value) def repositories_count=(value)
...@@ -140,6 +135,15 @@ class GeoNodeStatus ...@@ -140,6 +135,15 @@ class GeoNodeStatus
end end
end end
def repositories
@repositories ||=
if restricted_project_ids
Project.where(id: restricted_project_ids)
else
Project.all
end
end
def restricted_project_ids def restricted_project_ids
return @restricted_project_ids if defined?(@restricted_project_ids) return @restricted_project_ids if defined?(@restricted_project_ids)
......
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