Skip to content

Commit

Permalink
Fix map deletion when x and y are nil or 0 #380
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Reed committed Dec 13, 2019
1 parent 1c3ae3b commit 9c43091
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/controllers/cc_questions_controller.rb
Expand Up @@ -48,8 +48,8 @@ def add_variables
def remove_variable
@object.maps.where(
variable: Variable.find(params[:variable_id]),
x: params[:x],
y: params[:y]
x: [params[:x], params[:x].to_i],
y: [params[:y], params[:y].to_i],
).delete_all
respond_to do |format|
format.json { render json: true, status: :accepted }
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/variables_controller.rb
Expand Up @@ -37,8 +37,8 @@ def remove_source
@object.maps.where(
source_type: params[:other][:class],
source_id: params[:other][:id],
x: params[:other][:x],
y: params[:other][:y]
x: [params[:other][:x], params[:other][:x].to_i],
y: [params[:other][:y], params[:other][:y].to_i],
).delete_all
@object.reload
render 'variables/show'
Expand Down

0 comments on commit 9c43091

Please sign in to comment.