Skip to content

Commit

Permalink
fixing #96
Browse files Browse the repository at this point in the history
  • Loading branch information
sam9116 committed Oct 28, 2024
1 parent 8c24b1a commit 5cb7b03
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/TaleSetup/BaseInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ const BaseInput = forwardRef(({ setConcerts,
var allCombinationOfConcerts = generateCombinations(groupedByArtistConcertList);

if (allCombinationOfConcerts.length < 1) {
alert(`Unable to schedule a plan for the artists you want to see, their schedules conflict with each other, removing the last artist you added since it was causing problems`);
alert(`Unable to schedule a plan for the artists you want to see, their schedules conflict with each other`);
//remove the last attempted artist that was causing problem and run the optimization again
generateOptimizedConcertRoute(allConcerts, userLocation, artistWishlist.slice(-1));
generateOptimizedConcertRoute(allConcerts, userLocation, artistWishlist.slice(0, -1));
}

//now sort the remaining by max distance traveled
Expand All @@ -264,9 +264,13 @@ const BaseInput = forwardRef(({ setConcerts,
// this need to be a list
console.log(`allCombinationOfConcerts[0]: ${JSON.stringify(allCombinationOfConcerts[0])}`);

var optimizedConcerts = allCombinationOfConcerts[0];
if(allCombinationOfConcerts.length > 1)
{
var optimizedConcerts = allCombinationOfConcerts[0];

setConcerts(optimizedConcerts);
}

setConcerts(optimizedConcerts);

}

Expand Down

0 comments on commit 5cb7b03

Please sign in to comment.