From eb870d983f2dce4143fbc0d451e6d09b0dbf80e5 Mon Sep 17 00:00:00 2001
From: ezsh <ezsh.junk@gmail.com>
Date: Fri, 29 Jan 2021 11:44:09 +0100
Subject: [PATCH] Fix RA shrink/grow comparisons for exact equal condition

It has to use "greater/less or equal" condition, and additionally move
step around to replicate the action RA will perform.
---
 src/js/rulesAssistant.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/js/rulesAssistant.js b/src/js/rulesAssistant.js
index c4857c8310a..715c033e8eb 100644
--- a/src/js/rulesAssistant.js
+++ b/src/js/rulesAssistant.js
@@ -547,7 +547,7 @@ App.RA.makeRange = function(minValue, maxValue) {
  * @returns {boolean}
  */
 App.RA.shallGrow = function(current, target, step = 1) {
-	return target && (((current < target.val - step) && (target.cond === '==')) ||
+	return target && (((current + step <= target.val) && (target.cond === '==')) ||
 		((current < target.val) && (target.cond === '>=' || target.cond === '>')) ||
 		(current === target.val && target.cond === '>'));
 };
@@ -560,7 +560,7 @@ App.RA.shallGrow = function(current, target, step = 1) {
  * @returns {boolean}
  */
 App.RA.shallShrink = function(current, target, step = 1) {
-	return target && (((current > target.val + step) && (target.cond === '==')) ||
+	return target && (((current - step >= target.val) && (target.cond === '==')) ||
 		((current > target.val) && (target.cond === '<=' || target.cond === '<')) ||
 		(current === target.val && target.cond === '<'));
 };
-- 
GitLab