Commit 54d5df6e by Chaiwith Santaweesuk

update

parents 5eb0847e 4fbbc1ee
...@@ -183,7 +183,7 @@ class Home extends Component { ...@@ -183,7 +183,7 @@ class Home extends Component {
loopFeedData = async (deviceId, selectedRange, breakdown) => { loopFeedData = async (deviceId, selectedRange, breakdown) => {
clearInterval(this.looper); clearInterval(this.looper);
await this.getFeedData(deviceId, selectedRange, breakdown); await this.getFeedData(deviceId, selectedRange, breakdown);
this.looper = setInterval(async () => await this.getFeedData(deviceId, selectedRange, breakdown), 60000); this.looper = setInterval(async () => await this.getFeedData(deviceId, selectedRange, breakdown), 300000);
}; };
getFeedData = async ( getFeedData = async (
...@@ -193,14 +193,11 @@ class Home extends Component { ...@@ -193,14 +193,11 @@ class Home extends Component {
) => { ) => {
const { kairosUrl, userToken } = this.state; const { kairosUrl, userToken } = this.state;
const { startDate, endDate } = selectedRange; const { startDate, endDate } = selectedRange;
const now = moment().valueOf(); // const now = moment().valueOf();
// tags = ['Current Cash']
// ["Revenue", "Reset" ,"Remote" ,"People" ,"Fingerprint"]
const q_data = { const q_data = {
start_absolute: startDate || now, start_absolute: startDate,
end_absolute: endDate || now, end_absolute: endDate,
metrics: [ metrics: [
{ {
name: deviceId || this.state.allDevicesId[0], name: deviceId || this.state.allDevicesId[0],
...@@ -284,7 +281,7 @@ class Home extends Component { ...@@ -284,7 +281,7 @@ class Home extends Component {
fingerPrintMax: Math.round(this.getMax(fingerPrintFeed) * 100) / 100, fingerPrintMax: Math.round(this.getMax(fingerPrintFeed) * 100) / 100,
fingerPrintMin: Math.round(this.getMin(fingerPrintFeed) * 100) / 100, fingerPrintMin: Math.round(this.getMin(fingerPrintFeed) * 100) / 100,
fingerPrintAvg: Math.round(this.getAvg(fingerPrintFeed) * 100) / 100, fingerPrintAvg: Math.round(this.getAvg(fingerPrintFeed) * 100) / 100,
keycardTotal: Math.round((this.getTotal(keycardFeed) * 100) / 100, keycardTotal: Math.round(this.getTotal(keycardFeed) * 100) / 100,
keycardMax: Math.round(this.getMax(keycardFeed) * 100) / 100, keycardMax: Math.round(this.getMax(keycardFeed) * 100) / 100,
keycardMin: Math.round(this.getMin(keycardFeed) * 100) / 100, keycardMin: Math.round(this.getMin(keycardFeed) * 100) / 100,
keycardAvg: Math.round(this.getAvg(keycardFeed) * 100) / 100, keycardAvg: Math.round(this.getAvg(keycardFeed) * 100) / 100,
...@@ -352,10 +349,8 @@ class Home extends Component { ...@@ -352,10 +349,8 @@ class Home extends Component {
current: data[3][i][1], current: data[3][i][1],
timestamp: moment(data[1][i][0]).format('D/M/YY HH:mm'), timestamp: moment(data[1][i][0]).format('D/M/YY HH:mm'),
}; };
table.unshift(v); table.unshift(v);
} }
return table; return table;
}; };
......
...@@ -38,7 +38,7 @@ const DataCard = props => { ...@@ -38,7 +38,7 @@ const DataCard = props => {
if (props.feedData) { if (props.feedData) {
var dataObj = props.feedData.map(value => ({ var dataObj = props.feedData.map(value => ({
xAxis: moment(value[0]).format('D/M/YY H:mm'), xAxis: moment(value[0]).format('D/M/YY HH:mm'),
yAxis: value[1], yAxis: value[1],
})); }));
} }
......
...@@ -8,7 +8,7 @@ class GetDataSelection extends PureComponent { ...@@ -8,7 +8,7 @@ class GetDataSelection extends PureComponent {
device: null, device: null,
range: { range: {
startDate: moment() startDate: moment()
.subtract(1, 'days') .startOf('day')
.valueOf(), .valueOf(),
endDate: moment().valueOf(), endDate: moment().valueOf(),
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment