Fixed: the progress bar goes over 100% and displays "NaN%" if the MP2 tables are empty.

This commit is contained in:
fred
2017-05-25 18:26:56 +02:00
parent bbad772d7a
commit c96bc755c7

View File

@@ -55,7 +55,10 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
dataType: 'json' dataType: 'json'
}).always(function (result) { }).always(function (result) {
// Move the progress bar // Move the progress bar
var progress = Math.round(Number(result.current) / Number(result.total) * 100); var progress = 100;
if(Number(result.total) !== 0) {
progress = Math.round(Number(result.current) / Number(result.total) * 100);
}
jQuery('#progressbar').progressbar('option', 'value', progress); jQuery('#progressbar').progressbar('option', 'value', progress);
jQuery('#progresslabel').html(progress + '%'); jQuery('#progresslabel').html(progress + '%');
if(MailPoet.MP2Migrator.is_logging) { if(MailPoet.MP2Migrator.is_logging) {