Don't add the destination QU multiple time in productamountpicker

This commit is contained in:
Bernd Bestel 2020-11-10 21:19:51 +01:00
parent 4959e9e732
commit 7f600bd8d9
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -17,7 +17,10 @@ Grocy.Components.ProductAmountPicker.Reload = function(productId, destinationQuI
factor = 1;
}
$("#qu_id").append('<option value="' + conversion.to_qu_id + '" data-qu-factor="' + factor + '">' + conversion.to_qu_name + '</option>');
if (!$('#qu_id option[value="' + conversion.to_qu_id + '"]').length) // Don't add the destination QU multiple times
{
$("#qu_id").append('<option value="' + conversion.to_qu_id + '" data-qu-factor="' + factor + '">' + conversion.to_qu_name + '</option>');
}
});
}