Skip to content
Snippets Groups Projects
Commit cd701824 authored by Allen Gilliland's avatar Allen Gilliland
Browse files

Merge pull request #483 from metabase/fix_filter_NaN_bug

fix filter value casting logic so that we don't accidentally try to d…
parents 19a07e0a 29a51e45
Branches
Tags
No related merge requests found
......@@ -142,16 +142,20 @@ export default React.createClass({
setValue: function(value, index, filterListIndex) {
var filter = this.props.filter;
// value casting. we need the value in the filter to be of the proper type
if (this.state.fieldDef.base_type === "IntegerField") {
value = parseInt(value);
} else if (this.state.fieldDef.base_type === "BooleanField") {
value = (value.toLowerCase() === "true") ? true : false;
} else if (this.state.fieldDef.base_type === "FloatField") {
value = parseFloat(value);
}
if (value && value.length > 0) {
// value casting. we need the value in the filter to be of the proper type
if (this.state.fieldDef.base_type === "IntegerField") {
value = parseInt(value);
} else if (this.state.fieldDef.base_type === "BooleanField") {
value = (value.toLowerCase() === "true") ? true : false;
} else if (this.state.fieldDef.base_type === "FloatField") {
value = parseFloat(value);
}
// TODO: we may need to do some date formatting work on DateTimeField and DateField
// TODO: we may need to do some date formatting work on DateTimeField and DateField
} else {
value = null;
}
if (value !== undefined) {
filter[index] = value;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment