-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[ADD] todo: add new todo, card and counter components #972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 🥇
3187e2e
to
3c99f45
Compare
fd4aa1a
to
0df9683
Compare
3a8ad0d
to
919ca6d
Compare
if (index === -1) { | ||
this.disabledElements.push(id); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What your function does is:
- If item is already disabled, remove it from the list
- If item is not disabled add it to disabled list
Thus, this if condition is actually half of your functionality. But when you return inside the block it looks like it's a corner case and for most records what will execute isthis.disabledElements.splice(index, 1);
which is not true.
In this case I would prefer to have
if (index === -1) { | |
this.disabledElements.push(id); | |
return; | |
} | |
if (index === -1) { | |
this.disabledElements.push(id); | |
} | |
else { | |
do other thing | |
} |
so what your method does is clearer.
This is of course up for debate. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's a matter of preference.
I usually prefer to do early returns instead of else statements, so that if the function gets more complicated, I don't need to nest so much.
In this case it's probably the same.
919ca6d
to
bce86ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, just keep in mind the ir.config_parameter will stay the same for every user (you can define it to be specific to company in a multi-company environment). But I was the one baiting you into using it instead of res_users so, 👍
A work around with only using ir.config_parameter is saving a json object as the parameter that has the shape {'user_id': disabledItems} then you can get the specific setting for every user
No description provided.