Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldhur committed Nov 24, 2017
1 parent 148484d commit fc78438
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/components/main/TitleCurrentTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import moment from 'moment';

class TitleCurrentTime extends Component {
render() {
const {currentTime} = this.props;
const {currentTime, avg} = this.props;
const timeFormat = avg.by.startsWith('min') ? "DD-MM-YYYY HH:mm" : "DD-MM-YYYY HH:mm:ss";

return (
<div>{currentTime ? moment(currentTime).format("DD-MM-YYYY HH:mm") : 'Time not selected'}</div>
<div>{currentTime ? moment(currentTime).format(timeFormat) : 'Time not selected'}</div>
);
}
}
Expand All @@ -18,6 +19,7 @@ TitleCurrentTime.defaultProps = {};

function mapStateToProps(state) {
return {
avg: state.main.settings.project.time.avg,
currentTime: state.chart.chartCurrentTime ? new Date(state.chart.chartCurrentTime) : null,
};
}
Expand Down
2 changes: 1 addition & 1 deletion app/workers/prepareValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function prepareValues(data, time, rowLength) {
if (time.extreme.frequency < avg.time) {
format = VALUES_AVG;
rows = prepareFormatedValues(rows, time, format);
} else if (Math.abs(time.extreme.start - rows[0][0].valueOf()) > 0) {
} else if (time.extreme.frequency > avg.time || Math.abs(time.extreme.start - rows[0][0].valueOf()) > 0) {
format = VALUES_INTERPOLATED;
rows = prepareInterpolatedValues(rows, time);
}
Expand Down

0 comments on commit fc78438

Please sign in to comment.