From 5811541722e7d32bf127715c9aad5f3c339ce186 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Wed, 12 Oct 2016 19:59:09 +0200 Subject: [PATCH] Invert conditions. --- accountant-ui/js/accounts.js | 6 +++--- accountant-ui/js/operations.js | 6 +++--- accountant-ui/js/scheduler.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/accountant-ui/js/accounts.js b/accountant-ui/js/accounts.js index 11719cc..85d0f92 100644 --- a/accountant-ui/js/accounts.js +++ b/accountant-ui/js/accounts.js @@ -110,11 +110,11 @@ angular.module('accountant.accounts', [ * Cancel account edition. Remove it from array if a new one. */ $scope.cancelEdit = function(rowform, account, $index) { - if (!account.id) { + if (account.id) { + rowform.$cancel(); + } else { // Account not saved, just remove it from array. $scope.accounts.splice($index, 1); - } else { - rowform.$cancel(); } }; diff --git a/accountant-ui/js/operations.js b/accountant-ui/js/operations.js index a29d9bf..7a1f55a 100644 --- a/accountant-ui/js/operations.js +++ b/accountant-ui/js/operations.js @@ -391,10 +391,10 @@ angular.module('accountant.operations', [ * Cancel edition. */ $scope.cancelEdit = function(operation, rowform, $index) { - if (!operation.id) { - $scope.operations.splice($index, 1); - } else { + if (operation.id) { rowform.$cancel(); + } else { + $scope.operations.splice($index, 1); } }; diff --git a/accountant-ui/js/scheduler.js b/accountant-ui/js/scheduler.js index 8c2731c..bc2d3ee 100644 --- a/accountant-ui/js/scheduler.js +++ b/accountant-ui/js/scheduler.js @@ -89,10 +89,10 @@ angular.module('accountant.scheduler', [ * Cancel operation edition. Delete if new. */ $scope.cancelEdit = function(operation, rowform, $index) { - if (!operation.id) { - $scope.operations.splice($index, 1); - } else { + if (operation.id) { rowform.$cancel(); + } else { + $scope.operations.splice($index, 1); } };