Update mbimport.js

i was already instanced when a few loops were attempting to recreate it.  Changed those 'var' statements to 'let's to better scope them to just the applicable loops.
This commit is contained in:
brianfreud 2019-03-17 22:57:37 -04:00 committed by Aurélien Mino
parent f30e6b6d5d
commit 7f212c141d

View file

@ -157,7 +157,7 @@ var MBImport = (function() {
buildArtistCreditsFormParameters(parameters, '', release.artist_credit);
if (release['secondary_types']) {
for (var i = 0; i < release.secondary_types.length; i++) {
for (let i = 0; i < release.secondary_types.length; i++) {
appendParameter(parameters, 'type', release.secondary_types[i]);
}
}
@ -188,7 +188,7 @@ var MBImport = (function() {
appendParameter(parameters, 'comment', release.comment);
// Label + catnos
for (var i = 0; i < release.labels.length; i++) {
for (let i = 0; i < release.labels.length; i++) {
let label = release.labels[i];
appendParameter(parameters, `labels.${i}.name`, label.name);
appendParameter(parameters, `labels.${i}.mbid`, label.mbid);
@ -208,7 +208,7 @@ var MBImport = (function() {
let total_tracks = 0;
let total_tracks_with_duration = 0;
let total_duration = 0;
for (var i = 0; i < release.discs.length; i++) {
for (let i = 0; i < release.discs.length; i++) {
let disc = release.discs[i];
appendParameter(parameters, `mediums.${i}.format`, disc.format);
appendParameter(parameters, `mediums.${i}.name`, disc.title);
@ -382,7 +382,7 @@ var MBImport = (function() {
totaltracks += release.discs[i].tracks.length;
}
let release_artist = '';
for (var i = 0; i < release.artist_credit.length; i++) {
for (let i = 0; i < release.artist_credit.length; i++) {
let ac = release.artist_credit[i];
release_artist += ac.artist_name;
if (typeof ac.joinphrase != 'undefined' && ac.joinphrase != '') {