Skip to content

Commit

Permalink
[hotfix] fix slices where since/until = None (#3401)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Aug 31, 2017
1 parent e53f303 commit 66f646a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ const propTypes = {
label: PropTypes.string,
description: PropTypes.string,
onChange: PropTypes.func,
value: PropTypes.string.isRequired,
value: PropTypes.string,
height: PropTypes.number,
};

const defaultProps = {
animation: true,
onChange: () => {},
value: null,
value: '',
};

export default class DateFilterControl extends React.Component {
constructor(props) {
super(props);
const words = props.value.split(' ');
const value = props.value || '';
this.state = {
num: '7',
grain: 'days',
Expand All @@ -43,16 +43,17 @@ export default class DateFilterControl extends React.Component {
type: 'free',
free: '',
};
const words = value.split(' ');
if (words.length >= 3 && RELATIVE_TIME_OPTIONS.indexOf(words[2]) >= 0) {
this.state.num = words[0];
this.state.grain = words[1];
this.state.rel = words[2];
this.state.type = 'rel';
} else if (moment(props.value).isValid()) {
this.state.dttm = props.value;
} else if (moment(value).isValid()) {
this.state.dttm = value;
this.state.type = 'fix';
} else {
this.state.free = props.value;
this.state.free = value;
this.state.type = 'free';
}
}
Expand Down Expand Up @@ -193,6 +194,7 @@ export default class DateFilterControl extends React.Component {
);
}
render() {
const value = this.props.value || '';
return (
<div>
<ControlHeader {...this.props} />
Expand All @@ -206,7 +208,7 @@ export default class DateFilterControl extends React.Component {
overlay={this.renderPopover()}
>
<Label style={{ cursor: 'pointer' }}>
{this.props.value.replace('T00:00:00', '') || '∞'}
{value.replace('T00:00:00', '') || '∞'}
</Label>
</OverlayTrigger>
</div>
Expand Down
2 changes: 1 addition & 1 deletion superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def query_obj(self):
# potential conflicts with column that would be named `from` or `to`
since = (
extra_filters.get('__from') or
form_data.get("since")
form_data.get("since") or ''
)

# Backward compatibility hack
Expand Down

0 comments on commit 66f646a

Please sign in to comment.