Skip to content

Commit

Permalink
holy fuck unexpected win from AI once more, we are no longer limited …
Browse files Browse the repository at this point in the history
…to 5 concerts!
  • Loading branch information
sam9116 committed Nov 20, 2024
1 parent 65ff987 commit 4c1ba48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 11 additions & 12 deletions src/TaleSetup/BaseInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,26 @@ function generateCombinations(dictionary) {
const keys = Object.keys(dictionary);
const result = [];

function backtrack(combination, index) {
function backtrack(combination, index, lastDate, lastLocation, lastTitle) {
if (index === keys.length) {
const dates = combination.map(concert => concert.date);
const sortedDates = [...dates].sort();
if (JSON.stringify(dates) === (JSON.stringify(sortedDates))) {
result.push([...combination]);
}
result.push([...combination]);
return;
}

const key = keys[index];
const values = dictionary[key];

for (const value of values) {
combination.push(value);
backtrack(combination, index + 1);
combination.pop();
const concertDate = new Date(value.date);
if (concertDate >= lastDate && (concertDate !== lastDate || (value.location.name === lastLocation.name && value.location.address === lastLocation.address && value.title === lastTitle))) {
combination.push(value);
backtrack(combination, index + 1, concertDate, value.location, value.title);
combination.pop();
}
}
}

backtrack([], 0);
backtrack([], 0, new Date(0), { name: null, address: null }, null);
return result;
}

Expand Down Expand Up @@ -139,10 +138,10 @@ const BaseInput = forwardRef(({ setConcerts,
const [artistName, setArtistName] = useState("Taylor Swift");
const submitArtistInfo = async (incomingArtistInfo) => {

if (artistWishlist.length >= 5) {
/*if (artistWishlist.length >= 5) {
alert(`You can have only 5 artists at a time.`)
return
}
}*/
let incomingArtistName = incomingArtistInfo.name;
let incomingArtistId = incomingArtistInfo.id
try {
Expand Down
2 changes: 1 addition & 1 deletion src/TaleSetup/ConcertList.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class ConcertList extends React.Component {
<div>
{hasConcerts && (
<Typography>
Upcoming Concerts <br />({this.state.concerts.length} / 5):
Upcoming Concerts ({this.state.concerts.length}) :
</Typography>
)}
{hasConcerts && (
Expand Down

0 comments on commit 4c1ba48

Please sign in to comment.