-
-
Save zavod008/90f2210814e2c2116d421c4ab6bce9ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (room.book.length > 0) { | |
let book = room.book.reduce((result, item) => { | |
return result + item.count; | |
}, 0); | |
console.log(book); | |
if (item.count + 1 > room.free || book === room.free) { | |
return false; | |
} | |
room.list.forEach(itemTest => { | |
if (itemTest.group !== item.group) { | |
itemTest.class = 'hide'; | |
} | |
}); | |
room.book.forEach(itemTest => { | |
if (itemTest.id === item.id) { | |
itemTest.count = item.count + 1 | |
} else { | |
room.book.push({ | |
count: item.count + 1, | |
group: item.group, | |
id: item.id | |
}); | |
} | |
}) | |
} else { | |
room.book.push({ | |
count: item.count + 1, | |
group: item.group, | |
id: item.id | |
}); | |
} | |
item.count += 1; | |
item.class = 'active'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment