From b945171f2ff3a4cf4d30c40d6a5665f0946146c3 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Thu, 19 Dec 2019 15:48:25 +0100 Subject: [PATCH] Fix creation of new tasks on canvas [SCI-4171] --- app/controllers/canvas_controller.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/app/controllers/canvas_controller.rb b/app/controllers/canvas_controller.rb index ede012a2e..35582816b 100644 --- a/app/controllers/canvas_controller.rb +++ b/app/controllers/canvas_controller.rb @@ -66,14 +66,8 @@ class CanvasController < ApplicationController float?(pos[1]) && float?(pos[2]) return render_403 end - if index.zero? - center = pos - x = 0 - y = 0 - else - x = pos[1].to_i - center[1].to_i - y = pos[2].to_i - center[2].to_i - end + x = pos[1].to_i + y = pos[2].to_i # Multiple modules cannot have same position return render_403 if positions.any? { |_, v| v[:x] == x && v[:y] == y } positions[pos[0]] = { x: x, y: y }