File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -298,7 +298,7 @@ def formatted_best_stat_value(protip)
298
298
value =
299
299
case best_stat_name ( protip ) . to_sym
300
300
when :views
301
- best_stat_value ( protip ) * Protip :: COUNTABLE_VIEWS_CHUNK
301
+ views_stat_value ( protip )
302
302
else
303
303
best_stat_value ( protip )
304
304
end
@@ -348,4 +348,17 @@ def default_featured_job_banner
348
348
def protip_display_mode
349
349
mobile_device? ? "fullpage" : "popup"
350
350
end
351
+
352
+ def views_stat_value ( protip )
353
+ best_stat_value ( protip ) * Protip ::COUNTABLE_VIEWS_CHUNK
354
+ end
355
+
356
+ def display_protip_stats? ( protip )
357
+ stat_name = best_stat_name ( protip )
358
+ # if stat is present, and the stat we're displaying is views over 50, display.
359
+ # otherwise, we're showing stats for something other than views.
360
+ return true if protip . best_stat . present? && stat_name == :views && views_stat_value ( protip ) > 50
361
+ return true if protip . best_stat . present? && stat_name != :views
362
+ return false
363
+ end
351
364
end
Original file line number Diff line number Diff line change 1
1
- protip = protip.load #this is simply a hack, fix ES indexed json
2
2
%article {:class => dom_class(protip), :id => protip.public_id}
3
- %header
4
- - unless protip.best_stat.nil? || best_stat_value(protip) == 0
3
+ - if display_protip_stats?(protip)
4
+ %header
5
5
%span{:class => protip_stat_class(protip)}
6
6
= formatted_best_stat_value(protip) unless best_stat_name(protip) =~ /hawt/
7
7
You can’t perform that action at this time.
0 commit comments