From 1918b911b3e798d0d48cf9902c0eb92b742c7b46 Mon Sep 17 00:00:00 2001 From: Jasmine Schladen Date: Thu, 18 Feb 2021 14:28:15 -0800 Subject: [PATCH] Make code more parallel --- lemur/static/app/angular/notifications/services.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lemur/static/app/angular/notifications/services.js b/lemur/static/app/angular/notifications/services.js index e1a645db..2259d6b3 100644 --- a/lemur/static/app/angular/notifications/services.js +++ b/lemur/static/app/angular/notifications/services.js @@ -14,9 +14,9 @@ angular.module('lemur') this.certificates.push(certificate); this.addedCertificates.push(certificate); if (this.removedCertificates !== undefined) { - const index = this.removedCertificates.indexOf(certificate); - if (index > -1) { - this.removedCertificates.splice(index, 1); + const removedIndex = this.removedCertificates.indexOf(certificate); + if (removedIndex > -1) { + this.removedCertificates.splice(removedIndex, 1); } } }, @@ -26,8 +26,11 @@ angular.module('lemur') } const removedCert = this.certificates.splice(index, 1); this.removedCertificates.push(removedCert); - if (this.addedCertificates !== undefined && this.addedCertificates.indexOf(removedCert) > -1) { - this.addedCertificates.splice(this.addedCertificates.indexOf(removedCert), 1); + if (this.addedCertificates !== undefined) { + const addedIndex = this.addedCertificates.indexOf(removedCert); + if (addedIndex > -1) { + this.addedCertificates.splice(addedIndex, 1); + } } } });