Class: ForestLiana::StatsController
Constant Summary
collapse
- CHART_TYPE_VALUE =
'Value'
- CHART_TYPE_PIE =
'Pie'
- CHART_TYPE_LINE =
'Line'
- CHART_TYPE_LEADERBOARD =
'Leaderboard'
- CHART_TYPE_OBJECTIVE =
'Objective'
Instance Method Summary
collapse
#authenticate_user_from_jwt, #forest_user, #get_smart_action_context, #internal_server_error, papertrail?, #serialize_model, #serialize_models
#route_not_found
Instance Method Details
#get_with_live_query ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'app/controllers/forest_liana/stats_controller.rb', line 49
def get_with_live_query
begin
stat = QueryStatGetter.new(params)
stat.perform
if stat.record
render json: serialize_model(stat.record), serializer: nil
else
render json: {status: 404}, status: :not_found, serializer: nil
end
rescue ForestLiana::Errors::LiveQueryError => error
render json: { errors: [{ status: 422, detail: error.message }] },
status: :unprocessable_entity, serializer: nil
rescue => error
FOREST_LOGGER.error "Live Query error: #{error.message}"
render json: { errors: [{ status: 422, detail: error.message }] },
status: :unprocessable_entity, serializer: nil
end
end
|