Add new stat
This commit is contained in:
@@ -3,6 +3,7 @@ module Api::V1
|
||||
def index
|
||||
@park_count = Park.count
|
||||
@alert_count = Alert.count
|
||||
@state_with_most_parks = ParksByState.group(:state).count.max
|
||||
@park_with_most_alerts = Alert.group(:park_code).count.max
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
json.park_count @park_count
|
||||
json.alert_count @alert_count
|
||||
json.most_alerts do
|
||||
json.state_with_most_parks do
|
||||
json.state @state_with_most_parks[0]
|
||||
json.park_count @state_with_most_parks[1]
|
||||
end
|
||||
json.park_with_most_alerts do
|
||||
json.park_code @park_with_most_alerts[0]
|
||||
json.alert_count @park_with_most_alerts[1]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user