Use Set() natively

This commit is contained in:
Ludovic Stephan 2017-03-31 10:06:02 -03:00
parent e54324e9f1
commit 50cb6e51a1

View file

@ -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 += '<ul>';