Commit 47cda758 by Chaiwith Santaweesuk

update

parent 1e1c8fdf
asset-manifest.json,1579179624538,d86334a5ed7af62e66a3ec39ad76c3a0951f36c6dbff1da13c312d6757f93452
index.html,1579179624538,836f1320b57a99c82b6e65b7c01e3d3b47e277f0034da3d1c840e1d53c965226
precache-manifest.750b9a35ed6c2c0b8ead3f9686e6aff8.js,1579179624538,a762996968439990d33454d45f939a634d2ac4f972aadea8b07f1a7bf5bafe5e
asset-manifest.json,1579781301283,593433679696a4df764ad836b6e90fcaf06721d526a4c0261510f392f785a8c2
precache-manifest.cffe17292f0ab61fe93eeeba6e95ab6d.js,1579781301283,32514bfcf692e6d08a828a5baa79ab1f643c8324fee89c17a98ed126fb0a3140
index.html,1579781301282,01ce637ac24816bc1eb294f8269b1b64f744e8ff3399e67c2421ce548dd97a3b
service-worker.js,1579781301283,97782fb3e8fc23ce29affa064620a7281a0b20570ec7e26addeaefc76b24ea28
manifest.json,1573632936000,851311324495b7eadd44a9e70f013e60f6ac9965a5a155cb4734894fd0e7dd5f
home.png,1573632936000,d3b21fd280b3304b29b980aab96dce3fb728c5a6c31f04c8dcf94480770e19ef
static/css/2.38695c78.chunk.css.map,1579179624629,aee7adea8d3da5aba91a0208f66abdbbfcad0c53c36e3e69a24c51de68e4f62d
service-worker.js,1579179624538,626fc5d2175a3ac2237b80c9754144257c15401543f65c372109388e469c4f69
static/css/2.38695c78.chunk.css,1579179624627,df7c74b70fea8b04fd0985d5d2a2a2e7d14eb9920dbd0f99d131abbaf3fd44ce
static/js/runtime~main.a8a9905a.js,1579179624627,e1af5f94fdd13901b2e433d0d7607e27c01458151c35b1fe4b7feda2a32b7aa9
static/js/main.3769dc56.chunk.js,1579179624556,689983ca2f41b7d06c90f4b0a5cef80d65a1d33340997606e34efe16285cfb8f
static/js/runtime~main.a8a9905a.js.map,1579179624634,c337bf8b58896da637a6e50ab8cfc779eb1ec42c55f8ec429030a03454a549db
static/css/main.93c33a43.chunk.css,1579179624544,20bf61433c569ccd069908c4e498759cb46dfccb12d8bf1aba9ccb8e61bd8b86
static/js/main.3769dc56.chunk.js.map,1579179624634,94c8b7b7d15c013e7ac01568a54339159c1f6cff83366b3ecbb3f0e3f9f5829f
static/css/main.93c33a43.chunk.css.map,1579179624629,a48d1e6da1a0ce76bde9786f2a1e10b880e0c11d0a38b09e296cfe0c4ac41c87
static/js/2.a00db17a.chunk.js,1579179624629,8fd3c3a6bfd7c93a5c61bdbd34e05b1ee97acebb97f05818a9246e567730bd37
static/js/2.a00db17a.chunk.js.map,1579179624634,ba338a06f2175d8381a522b257a7afa1bc9ece3785a9b8680dad2823f1354f00
static/css/2.38695c78.chunk.css,1579781301351,df7c74b70fea8b04fd0985d5d2a2a2e7d14eb9920dbd0f99d131abbaf3fd44ce
static/css/2.38695c78.chunk.css.map,1579781301346,aee7adea8d3da5aba91a0208f66abdbbfcad0c53c36e3e69a24c51de68e4f62d
static/js/runtime~main.a8a9905a.js,1579781301351,e1af5f94fdd13901b2e433d0d7607e27c01458151c35b1fe4b7feda2a32b7aa9
static/js/runtime~main.a8a9905a.js.map,1579781301350,c337bf8b58896da637a6e50ab8cfc779eb1ec42c55f8ec429030a03454a549db
static/js/main.7003d537.chunk.js,1579781301346,f2982231325c643a54b28e1ac0a6a59d932d64c4a221d6ee56fd816da170714a
static/css/main.93c33a43.chunk.css,1579781301346,20bf61433c569ccd069908c4e498759cb46dfccb12d8bf1aba9ccb8e61bd8b86
static/js/main.7003d537.chunk.js.map,1579781301346,6165e56745c27855922711367f9ade8511aac901decf83764ee3fd3e5d91f1ef
static/css/main.93c33a43.chunk.css.map,1579781301346,a48d1e6da1a0ce76bde9786f2a1e10b880e0c11d0a38b09e296cfe0c4ac41c87
static/js/2.a00db17a.chunk.js,1579781301351,8fd3c3a6bfd7c93a5c61bdbd34e05b1ee97acebb97f05818a9246e567730bd37
static/js/2.a00db17a.chunk.js.map,1579781301350,ba338a06f2175d8381a522b257a7afa1bc9ece3785a9b8680dad2823f1354f00
......@@ -23,16 +23,30 @@ export const getFeedData = () => async (dispatch, getState) => {
const { kairosUrl, userToken } = fireStoreReducer.fireStoreConfig;
const { devices, range, breakdown } = selectedFeedReducer.selectedFeed;
const attrList = [
{ tag: "['Current Cash']", aggregator: 'last' },
{ tag: 'Revenue', aggregator: 'sum' },
{ tag: 'Remote', aggregator: 'sum' },
{ tag: 'People', aggregator: 'sum' },
{ tag: 'Fingerprint', aggregator: 'sum' },
{ tag: 'Keycard', aggregator: 'sum' }
];
let attrList;
let metrics = [];
devices.forEach(device => {
// console.log(device)
if (device == "3d2951a5-fa10-4d56-abae-bc471f3d2e1f") {
attrList = [
{ tag: "['Current Cash']", aggregator: 'last' },
{ tag: 'Revenue', aggregator: 'last' },
{ tag: 'Remote', aggregator: 'last' },
{ tag: 'People', aggregator: 'last' },
{ tag: 'Fingerprint', aggregator: 'last' },
{ tag: 'Keycard', aggregator: 'last' }
];
}
else {
attrList = [
{ tag: "['Current Cash']", aggregator: 'last' },
{ tag: 'Revenue', aggregator: 'sum' },
{ tag: 'Remote', aggregator: 'sum' },
{ tag: 'People', aggregator: 'sum' },
{ tag: 'Fingerprint', aggregator: 'sum' },
{ tag: 'Keycard', aggregator: 'sum' }
]
}
attrList.forEach(element => {
const metric = {
name: device,
......@@ -62,9 +76,7 @@ export const getFeedData = () => async (dispatch, getState) => {
start_absolute: range.startDate,
end_absolute: range.endDate,
metrics: metrics
};
try {
// axios.defaults.headers.common['Authorization'] = `Bearer ${userToken}`;
// const response = await axios.post(kairosUrl, q_data);
......@@ -82,42 +94,114 @@ export const getFeedData = () => async (dispatch, getState) => {
let fingerPrintFeedList = [];
let keycardFeedList = [];
response.data.queries.forEach(query => {
if (query.results[0].tags.attr == "['Current Cash']") {
currentFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
// let revenueFeed = { deviceId: query.results[0].name, value: [] }
// for (let index = 1; index < query.results[0].values.length; index++) {
// const current = query.results[0].values[index][1];
// const before = query.results[0].values[index - 1][1];
// if (current - before >= 0) {
// console.log(current - before)
// revenueFeed.value[revenueFeed.value.length] = [query.results[0].values[index][0], current - before]
// console.log(revenueFeed)
// }
// else {
// revenueFeed.value[revenueFeed.value.length] = [query.results[0].values[index][0], current]
// }
// if (index == query.results[0].values.length - 1) {
// revenueFeedList.push(revenueFeed);
// console.log(revenueFeedList)
// }
// }
}
else if (query.results[0].tags.attr == "Revenue") {
revenueFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
if (query.results[0].name == "3d2951a5-fa10-4d56-abae-bc471f3d2e1f") {
if (query.results[0].tags.attr == "['Current Cash']") {
currentFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
let revenueFeed = { deviceId: query.results[0].name, value: [] }
for (let index = 1; index < query.results[0].values.length; index++) {
const current = query.results[0].values[index][1];
const before = query.results[0].values[index - 1][1];
if (current - before >= 0) {
revenueFeed.value[revenueFeed.value.length] = [query.results[0].values[index][0], current - before]
}
else {
revenueFeed.value[revenueFeed.value.length] = [query.results[0].values[index][0], current]
}
if (index == query.results[0].values.length - 1) {
revenueFeedList.push(revenueFeed);
}
}
}
else if (query.results[0].tags.attr == "Remote") {
// remoteFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
let remoteFeed = { deviceId: query.results[0].name, value: [] }
for (let index = 1; index < query.results[0].values.length; index++) {
const current = query.results[0].values[index][1];
const before = query.results[0].values[index - 1][1];
if (current - before >= 0) {
remoteFeed.value[remoteFeed.value.length] = [query.results[0].values[index][0], current - before]
}
else {
remoteFeed.value[remoteFeed.value.length] = [query.results[0].values[index][0], current]
}
if (index == query.results[0].values.length - 1) {
remoteFeedList.push(remoteFeed);
}
}
}
else if (query.results[0].tags.attr == "People") {
// peopleFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
let peopleFeed = { deviceId: query.results[0].name, value: [] }
for (let index = 1; index < query.results[0].values.length; index++) {
const current = query.results[0].values[index][1];
const before = query.results[0].values[index - 1][1];
if (current - before >= 0) {
peopleFeed.value[peopleFeed.value.length] = [query.results[0].values[index][0], current - before]
}
else {
peopleFeed.value[peopleFeed.value.length] = [query.results[0].values[index][0], current]
}
if (index == query.results[0].values.length - 1) {
peopleFeedList.push(peopleFeed);
}
}
}
else if (query.results[0].tags.attr == "Fingerprint") {
// fingerPrintFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
let fingerPrintFeed = { deviceId: query.results[0].name, value: [] }
for (let index = 1; index < query.results[0].values.length; index++) {
const current = query.results[0].values[index][1];
const before = query.results[0].values[index - 1][1];
if (current - before >= 0) {
fingerPrintFeed.value[fingerPrintFeed.value.length] = [query.results[0].values[index][0], current - before]
}
else {
fingerPrintFeed.value[fingerPrintFeed.value.length] = [query.results[0].values[index][0], current]
}
if (index == query.results[0].values.length - 1) {
fingerPrintFeedList.push(fingerPrintFeed);
}
}
}
else if (query.results[0].tags.attr == "Keycard") {
// keycardFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
let keycardFeed = { deviceId: query.results[0].name, value: [] }
for (let index = 1; index < query.results[0].values.length; index++) {
const current = query.results[0].values[index][1];
const before = query.results[0].values[index - 1][1];
if (current - before >= 0) {
keycardFeed.value[keycardFeed.value.length] = [query.results[0].values[index][0], current - before]
}
else {
keycardFeed.value[keycardFeed.value.length] = [query.results[0].values[index][0], current]
}
if (index == query.results[0].values.length - 1) {
keycardFeedList.push(keycardFeed);
}
}
}
}
else if (query.results[0].tags.attr == "Remote") {
remoteFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
}
else if (query.results[0].tags.attr == "People") {
peopleFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
}
else if (query.results[0].tags.attr == "Fingerprint") {
fingerPrintFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
}
else if (query.results[0].tags.attr == "Keycard") {
keycardFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
else {
if (query.results[0].tags.attr == "['Current Cash']") {
currentFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
}
else if (query.results[0].tags.attr == "Revenue") {
revenueFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
}
else if (query.results[0].tags.attr == "Remote") {
remoteFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
}
else if (query.results[0].tags.attr == "People") {
peopleFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
}
else if (query.results[0].tags.attr == "Fingerprint") {
fingerPrintFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
}
else if (query.results[0].tags.attr == "Keycard") {
keycardFeedList.push({ deviceId: query.results[0].name, value: query.results[0].values });
}
}
});
// console.log(peopleFeedList)
// console.log(revenueFeedList)
......
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