Allow more flexible coersion from int to bool to fix unread perspective

This commit is contained in:
Ben Gotow 2017-06-28 22:42:11 -07:00
parent c84a6fd957
commit 72a4cbd3dd

View file

@ -13,10 +13,10 @@ export default class AttributeBoolean extends Attribute {
return val;
}
fromJSON(val) {
return ((val === 'true') || (val === 1) || (val === true)) || false;
return ((val === 'true') || (val / 1 >= 1) || (val === true)) || false;
}
fromColumn(val) {
return (val === 1) || false;
return (val >= 1) || false;
}
columnSQL() {
const defaultValue = this.defaultValue ? 1 : 0;