From a86d71b5c7c3d87068c24270675ebed6a05e1eb0 Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Fri, 18 Nov 2016 14:49:00 +0700
Subject: [PATCH] hanya push healthy jika blm terdaftar

---
 matrix-util.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/matrix-util.js b/matrix-util.js
index 6285069..7343b68 100644
--- a/matrix-util.js
+++ b/matrix-util.js
@@ -137,7 +137,7 @@ MatrixUtil.prototype._isPartnerHealthy = function(partner) {
 
 MatrixUtil.prototype.isPartnerHealthy = function(partner) {
     let matrix = this.matrix;
-    
+
     let isHealthy = this._isPartnerHealthy(partner);
 
     if (!matrix.healthy_partners) {
@@ -145,11 +145,14 @@ MatrixUtil.prototype.isPartnerHealthy = function(partner) {
     }
 
     // update matrix
+    let idx = matrix.healthy_partners.indexOf(partner);
+
     if (isHealthy) {
-        matrix.healthy_partners.push(partner);
+        if (idx < 0) {
+            matrix.healthy_partners.push(partner);
+        }
     }
     else {
-        let idx = matrix.healthy_partners.indexOf(partner);
         if (idx > -1) {
             matrix.healthy_partners.splice(idx, 1);
         }
-- 
1.9.0