Skip to content

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
x4d3 committed Nov 3, 2017
1 parent 8e351b5 commit dc40e61
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def index
auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }

begin
# TODO check there was no error, something like
# return render json: { message: "Unable to retrieve kpis from Impac API | Error #{response.code}" } unless response.success?
response = MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)
# TODO check there was no error, something like
# return render json: { message: "Unable to retrieve kpis from Impac API | Error #{response.code}" } unless response.success?
rescue => e
return render json: { message: "Unable to retrieve kpis from Impac API | Error #{e}" }
end
Expand All @@ -42,8 +42,7 @@ def index
target_placeholders: { watchable => kpi[:target_placeholders][watchable] },
)
end
end
.flatten
end.flatten

render json: { kpis: kpis }
end
Expand Down Expand Up @@ -85,7 +84,7 @@ def update
# Creates an in-app alert if target is set for the first time (in-app alerts should be activated by default)
if kpi.targets.blank? && params[:targets].present?
MnoEnterprise::Alert.create_with_recipients!({ service: 'inapp', kpi_id: kpi.id }, [current_user.id])
# If targets have changed, reset all the alerts 'sent' status to false.
# If targets have changed, reset all the alerts 'sent' status to false.
elsif kpi.targets && params[:targets].present? && params[:targets] != kpi.targets
kpi.alerts.each { |alert| alert.update_attributes(sent: false) }
# Removes all the alerts if the targets are removed (kpi has no targets set,
Expand Down

0 comments on commit dc40e61

Please sign in to comment.