From 50cb6e51a14be4ceb5315150091011c98ea0f2ed Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Fri, 31 Mar 2017 10:06:02 -0300 Subject: [PATCH] Use Set() natively --- kfet/templates/kfet/inventory_create.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kfet/templates/kfet/inventory_create.html b/kfet/templates/kfet/inventory_create.html index 17ab9dfc..4fccc2be 100644 --- a/kfet/templates/kfet/inventory_create.html +++ b/kfet/templates/kfet/inventory_create.html @@ -134,7 +134,7 @@ $(document).ready(function() { * Websocket */ - var conflicts = []; + var conflicts = new Set(); var websocket_msg_default = {'articles':[]} var websocket_protocol = window.location.protocol == 'https:' ? 'wss' : 'ws'; @@ -146,7 +146,7 @@ $(document).ready(function() { for (let article of data['articles']) { var $line = $('input[value="'+article.id+'"]').parent(); if ($line.find('.finished input').is(":checked")) { - conflicts.push(article.id); + conflicts.add(article.id); //Display warning $line.addClass('inventory_modified'); @@ -166,9 +166,8 @@ $(document).ready(function() { $('input[type="submit"]').on("click", function(e) { console.log(e.keyCode); e.preventDefault(); - conflicts = [...new Set(conflicts)]; //remove duplicates - if (conflicts.length) { + if (conflicts.size) { content = ''; content += "Conflits possibles :" content += '