Class: AhoyCaptain::PropertiesController
Instance Method Summary
collapse
#period
Methods included from Rangeable
#period
#compare_mode?, #comparison_mode, included
Instance Method Details
#index ⇒ Object
7
8
|
# File 'app/controllers/ahoy_captain/properties_controller.rb', line 7
def index
end
|
#show ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/ahoy_captain/properties_controller.rb', line 10
def show
value = Base64.urlsafe_decode64(params[:id])
@properties = event_query
.select(
"COALESCE(properties->>'#{value}', '(none)') AS label",
"COUNT(*) AS events_count",
"COUNT(DISTINCT visit_id) AS unique_visitors_count",
"(COUNT(DISTINCT visit_id)/COUNT(*)::numeric) * 100 as percentage"
)
.group("COALESCE(properties->>'#{value}', '(none)')")
.order(Arel.sql "COUNT(*) desc")
end
|