feat: SW-276 Optimized code

This commit is contained in:
Hrishikesh Vaipurkar
2024-09-24 13:38:19 +02:00
parent 510880d697
commit 8a04f840a2
8 changed files with 21 additions and 25 deletions

View File

@@ -23,19 +23,17 @@ export default function ChildSelector({
const childrenLabel = intl.formatMessage({ id: "Children" })
function decreaseChildren() {
if (roomChildren.length < 1) {
return
if (roomChildren.length > 0) {
roomChildren.pop()
updateChildren(roomChildren)
}
roomChildren.pop()
updateChildren(roomChildren)
}
function increaseChildren() {
if (roomChildren.length > 5) {
return
if (roomChildren.length < 5) {
roomChildren.push({ age: -1, bed: -1 })
updateChildren(roomChildren)
}
roomChildren.push({ age: -1, bed: -1 })
updateChildren(roomChildren)
}
function updateChildInfo(child: Child, index: number) {