Skip to content

Commit 6483a98

Browse files
committed
[WIP] Remove ProcessQueue from network
[Done] Unlist empty networks from admin dashboard.
1 parent b0e658c commit 6483a98

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

app/models/network.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class Network < ActiveRecord::Base
3131
before_save :correct_tags
3232
before_save :cache_counts!
3333
after_create :assign_members
34-
after_save :cleanup_orphans
3534

3635
scope :most_protips, order('protips_count_cache DESC')
3736
scope :featured, where(featured: true)
@@ -165,8 +164,6 @@ def to_public_hash
165164

166165
def protips
167166
@protips ||= Protip.tagged_with(self.tags, on: :topics)
168-
#@protips ||= Protip.search(nil, self.tags)
169-
170167
end
171168

172169
def upvotes
@@ -234,13 +231,6 @@ def assign_members
234231
end
235232
end
236233

237-
def cleanup_orphans
238-
ProcessingQueue.queue(:orphan_protips).each do |orphan|
239-
if orphan.queueable && orphan.queueable.networks.any?
240-
ProcessingQueue.unqueue(orphan.queueable, :orphan_protips)
241-
end
242-
end
243-
end
244234
end
245235

246236
# == Schema Information

app/views/admin/index.html.slim

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
h4 Pro tips created in networks in past week
7979
section
8080
ul.networks
81-
-Network.all.each do |network|
81+
-Network.where('protips_count_cache =! 0').order('protips_count_cache desc').each do |network|
8282
li.network
8383
span.name= link_to network.name, network_path(network)
8484
span.created_at= network.protips.where('created_at > ?', 1.week.ago).count
@@ -93,10 +93,4 @@
9393
-User.most_active_by_country.first(10).each do |user_group|
9494
li
9595
span.country = user_group.country
96-
span.count = user_group.count
97-
98-
99-
-if Rails.env.development?
100-
.right.clear
101-
h4=link_to('Toggle Premium Team', url_for(:controller => 'admin', :action => :toggle_premium_team))
102-
.clear
96+
span.count = user_group.count

0 commit comments

Comments
 (0)