Skip to content

Commit

Permalink
confidences exists route
Browse files Browse the repository at this point in the history
  • Loading branch information
mjy committed Jun 11, 2019
1 parent 41d6348 commit 04101d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/controllers/confidences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ def download
send_data Download.generate_csv(Confidence.where(project_id: sessions_current_project_id)), type: 'text', filename: "confidences_#{DateTime.now}.csv"
end

def exists
if @confidence = Confidence.exists?(params.require(:global_id),
params.require(:confidence_level_id),
sessions_current_project_id)
render :show
else
render json: false
end
end

private

def set_confidence
Expand Down
1 change: 1 addition & 0 deletions config/routes/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
post :confidence_object_update
end
end
get 'confidences/exists', to: 'confidences#exists', defaults: {format: :json}

resources :confidence_levels, only: [:index] do
collection do
Expand Down

0 comments on commit 04101d9

Please sign in to comment.