File tree 3 files changed +8
-3
lines changed
3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
class AdminController < BaseAdminController
2
2
3
3
def index
4
+ @networks = Network . where ( 'protips_count_cache > 0' ) . order ( 'protips_count_cache desc' )
4
5
end
5
6
6
7
def teams
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ def create_slug!
96
96
97
97
def tag_with_name!
98
98
unless self . tag_list . include? self . name
99
- self . tag_list = ( self . tag_list + [ self . name , self . slug ] )
99
+ self . tag_list . add ( self . slug )
100
100
end
101
101
end
102
102
@@ -240,4 +240,8 @@ def assign_members
240
240
end
241
241
end
242
242
243
+ def recent_protips_count
244
+ self . protips . where ( 'protips.created_at > ?' , 1 . week . ago ) . count
245
+ end
246
+
243
247
end
Original file line number Diff line number Diff line change 71
71
h4 Pro tips created in networks in past week
72
72
section
73
73
ul .networks
74
- -Network.where('protips_count_cache > 0').order('protips_count_cache desc') .each do |network|
74
+ -@networks .each do |network|
75
75
li .network
76
76
span .name = link_to network.name, network_path(network)
77
- span .created_at = network.protips.where('created_at > ?', 1.week.ago).count
77
+ span .created_at = network.recent_protips_count
78
78
79
79
. widget .orange
80
80
header
You can’t perform that action at this time.
0 commit comments