Skip to content

Instantly share code, notes, and snippets.

@mushfiqweb
Created June 28, 2020 10:55
Show Gist options
  • Select an option

  • Save mushfiqweb/09ed4799c53f7e0d1a5a581e5eebdf5d to your computer and use it in GitHub Desktop.

Select an option

Save mushfiqweb/09ed4799c53f7e0d1a5a581e5eebdf5d to your computer and use it in GitHub Desktop.
getData = (startDate, endDate, selectedView = 'daily') => {
// startDate = yestarday
// endDate = yestarday
let query = `{$and:[ {BuildingID: '${selfObj.state.BuildingId}'},
{Type:'daily'},
{StartDate:{$gte:new Date('${startDate}')}},
{EndDate:{$lte:new Date('${endDate}')}}]}`;
// console.log(query);
let apiHandler = new ApiHandler(SettingStore.getNosqlUrl(), SettingStore.getAppKey(), SettingStore.getKey());
apiHandler.getByQuery(query, "OS_EODReport", (response) => {
// console.log(response);
if (response.Status === "Success") {
var result = JSON.parse(response.Data);
if (result[0]) {
this.setState({
totalCountIn: result[0].TotalIn,
totalCountOut: result[0].TotalOut,
pickCount: result[0].PeakCount,
pickHour: result[0].PeakHour,
vsYesIn: result[0].Vs_YesterdayIn,
vsYesInPercent: result[0].Vs_YesterdayInPercent,
vsYesOut: result[0].Vs_YesterdayOut,
vsYesOutPercent: result[0].Vs_YesterdayOutPercent,
// vsMonIn: result[0].TotalOut,
// vsMonInPercent: result[0].TotalOut,
// vsMonOut: result[0].TotalOut,
// vsMonOutPercent: result[0].TotalOut,
// avgCount: result[0].TotalOut,
// popularZone: result[0].PopularZone,
// graphData: result[0].TimeWiseAveragePeopleReport,
// tableCurrent: JSON.parse(result[0].CurrentGateWiseCount),
// tablePrevious: JSON.parse(result[0].PreviousGateWiseCount),
// selectedView: selectedView,
// startIndex: 0,
// endIndex: tableJSON.length > 10 ? 10 : tableJSON.length,
// totalRows: tableJSON.length,
// currentPage: 1,
// totalPage: Math.ceil(tableJSON.length / 10)
});
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment