Skip to content

Commit

Permalink
Fix inclusion logic
Browse files Browse the repository at this point in the history
  • Loading branch information
noahm committed Mar 13, 2018
1 parent 06a6313 commit d77b5a0
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions src/songs/card-draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,30 @@ export function draw(configData) {

for (const currentSong of songs) {
const charts = currentSong[style];
if (
(!inclusions.has('usLocked') && currentSong['us_locked']) ||
(!inclusions.has('extraExclusive') && currentSong['extra_exclusive']) ||
(!inclusions.has('removed') && currentSong['removed']) ||
(!inclusions.has('unlock') && currentSong['unlock'])
) {
continue;
}

for (const key in charts) {
const chart = charts[key];

if (!(inclusions.has('usLocked') && currentSong['us_locked']) &&
!(inclusions.has('extraExclusive') && currentSong['extra_exclusive']) &&
!(inclusions.has('removed') && currentSong['removed']) &&
!(inclusions.has('unlock') && currentSong['unlock'])) {
for (const key in charts) {
const chart = charts[key];

if ((difficulties.has(key) && chart !== null) &&
(chart.difficulty >= lowerBound && chart.difficulty <= upperBound)) {
validCharts.push({
'name': currentSong.name,
'nameTranslation': currentSong.name_translation,
'artist': currentSong.artist,
'artistTranslation': currentSong.artist_translation,
'bpm': currentSong.bpm,
'difficulty': key,
'rating': chart.difficulty,
'hasShock': parseInt(chart.shock, 10) > 0,
});
}
if ((difficulties.has(key) && chart !== null) &&
(chart.difficulty >= lowerBound && chart.difficulty <= upperBound)) {
validCharts.push({
'name': currentSong.name,
'nameTranslation': currentSong.name_translation,
'artist': currentSong.artist,
'artistTranslation': currentSong.artist_translation,
'bpm': currentSong.bpm,
'difficulty': key,
'rating': chart.difficulty,
'hasShock': parseInt(chart.shock, 10) > 0,
});
}
}
}
Expand Down

0 comments on commit d77b5a0

Please sign in to comment.