Skip to content

Commit c501d24

Browse files
committed
fixed RR:subcounty filter bugs
1 parent 0a26b80 commit c501d24

18 files changed

+63
-60
lines changed

public/manifest.webapp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.1.1-beta",
2+
"version": "1.1.2-beta",
33
"name": "Health Commodities Dashboard - Beta",
44
"appType": "APP",
55
"description": "An App to Visualize Health Commodities data",

src/views/Accountability/Accountability.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const Accountability = props => {
103103
...reply
104104
}
105105
setErr(e_rr);
106-
if (e_rr.msg.includes('aborted')) {
106+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
107107
props.history.go(0)
108108
}
109109
} else {

src/views/DataQuality/DQComparison.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const DQComparison = props => {
9191
...reply
9292
}
9393
setErr(e_rr);
94-
if (e_rr.msg.includes('aborted')) {
94+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
9595
props.history.go(0)
9696
}
9797
} else {

src/views/DataQuality/DQCompleteness.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const DQCompleteness = props => {
9595
...reply
9696
}
9797
setErr(e_rr);
98-
if (e_rr.msg.includes('aborted')) {
98+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
9999
props.history.go(0)
100100
}
101101
} else {

src/views/DataQuality/DQConcordance.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,15 @@ const DQConcordance = props => {
9090
// .then(ad => ad.json())
9191
.then(reply => {
9292
if (reply.fetchedData == undefined || reply.fetchedData?.error) {
93-
setErr({
94-
error: true,
95-
msg: reply?.fetchedData?.message || '',
96-
...reply
97-
});
93+
let e_rr = {
94+
error: true,
95+
msg: reply?.fetchedData?.message || '',
96+
...reply
97+
}
98+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
99+
props.history.go(0)
100+
}
101+
console.error(reply)
98102
} else {
99103

100104
///////////////////////////////////////////////////////

src/views/DataQuality/DQConsistency.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const DQConsistency = props => {
9797
...reply
9898
}
9999
setErr(e_rr);
100-
if (e_rr.msg.includes('aborted')) {
100+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
101101
props.history.go(0)
102102
}
103103
} else {

src/views/HFFollowup/Overstocked.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const sumArr = arr => arr.reduce((a, b) => a + b, 0);
9494
...reply
9595
}
9696
setErr(e_rr);
97-
if (e_rr.msg.includes('aborted')) {
97+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
9898
props.history.go(0)
9999
}
100100
} else {

src/views/HFFollowup/Understocked.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const sumArr = arr => arr.reduce((a, b) => a + b, 0);
9494
...reply
9595
}
9696
setErr(e_rr);
97-
if (e_rr.msg.includes('aborted')) {
97+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
9898
props.history.go(0)
9999
}
100100
} else {

src/views/IssuesReceipts/IssuesReceipts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const IssuesReceipts = props => {
9393
}
9494
console.error(e_rr)
9595
console.error(reply)
96-
if (e_rr.msg.includes('aborted')) {
96+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
9797
props.history.go(0)
9898
}
9999
return e_rr

src/views/National/NatCommodities.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const NatCommodities = props => {
7676
...reply
7777
}
7878
setErr(e_rr);
79-
if (e_rr.msg.includes('aborted')) {
79+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
8080
props.history.go(0)
8181
}
8282
} else {

src/views/National/NatSummary.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const Dashboard = props => {
122122
...reply
123123
}
124124
setErr(e_rr);
125-
if (e_rr.msg.includes('aborted')) {
125+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
126126
props.history.go(0)
127127
}
128128
} else {

src/views/ReportingRate/RRFacility.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const RRFacility = props => {
9494
msg: reply?.fetchedData?.message || '',
9595
...reply
9696
}
97-
if (e_rr.msg.includes('aborted')) {
97+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
9898
props.history.go(0)
9999
}
100100
return e_rr

src/views/ReportingRate/RRSummary.js

+38-39
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ const RRSummary = props => {
4545
ep => ep.id == 'county__reporting_rate_trend'
4646
)[process.env.REACT_APP_ENV == "dev" ? "local_url" : "url"];
4747
let lv_l = '2'
48-
if(oun == null || oun == '~' || oun == "HfVjCurKxh2" || filter_params?.ou == '~' || filter_params?.ou == 'HfVjCurKxh2'){
48+
if (oun == null || oun == '~' || oun == "HfVjCurKxh2" || filter_params?.ou == '~' || filter_params?.ou == 'HfVjCurKxh2') {
4949
lv_l = '1'
5050
}
5151
let [url, setUrl] = useState(
5252
filterUrlConstructor(
5353
'LAST_6_MONTHS',
5454
filter_params.ou,
55-
lv_l,
55+
"~",//lv_l,
5656
base_rr_url
5757
)
5858
);
@@ -68,7 +68,7 @@ const RRSummary = props => {
6868
const [latestScRR, setLatestScRR] = useState([[]]);
6969
const [ScRRpe, setScRRpe] = useState('');
7070
const [scrrSubcounties, setScRRsubcs] = useState([[]]);
71-
71+
7272
const [err, setErr] = useState({ error: false, msg: '' });
7373
let title = `Reporting Rate: Summary`;
7474

@@ -104,11 +104,10 @@ const RRSummary = props => {
104104
msg: reply?.fetchedData?.message || '',
105105
...reply
106106
}
107-
if (e_rr.msg.includes('aborted')) {
107+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
108108
props.history.go(0)
109109
}
110-
console.error("iko shida")
111-
console.error(reply)
110+
console.error(rr_url + " : ", reply)
112111
return e_rr
113112
setErr(e_rr)
114113
} else {
@@ -132,8 +131,8 @@ const RRSummary = props => {
132131

133132
////////////// rr ////////////////
134133
rr_rows.map(ydate => {
135-
let date8 = ydate[reply.fetchedData.headers.findIndex(jk=>jk.name=="pe")];
136-
let data8 = ydate[reply.fetchedData.headers.findIndex(jk=>jk.name=="value")];
134+
let date8 = ydate[reply.fetchedData.headers.findIndex(jk => jk.name == "pe")];
135+
let data8 = ydate[reply.fetchedData.headers.findIndex(jk => jk.name == "value")];
137136
theorigdate.push(date8);
138137
let ydata = parseFloat(data8).toFixed(2);
139138
matched_data.push(ydata);
@@ -147,9 +146,9 @@ const RRSummary = props => {
147146
reply.fetchedData.metaData.dimensions.pe.map(o_rr_pe => {
148147
rr_rows.map((rw) => {
149148
let array1 = rw;
150-
if (array1[reply.fetchedData.headers.findIndex(jk=>jk.name=="pe")] === o_rr_pe) {
151-
let findata = parseFloat(array1[reply.fetchedData.headers.findIndex(jk=>jk.name=="value")]);
152-
let lenudate = array1[reply.fetchedData.headers.findIndex(jk=>jk.name=="pe")];
149+
if (array1[reply.fetchedData.headers.findIndex(jk => jk.name == "pe")] === o_rr_pe) {
150+
let findata = parseFloat(array1[reply.fetchedData.headers.findIndex(jk => jk.name == "value")]);
151+
let lenudate = array1[reply.fetchedData.headers.findIndex(jk => jk.name == "pe")];
153152
finalRRdata.push(findata);
154153
xc = 0;
155154
} else xc = 1;
@@ -170,9 +169,9 @@ const RRSummary = props => {
170169
let matched_data2 = [];
171170
let ondatarr = [];
172171
ot_rr_rows.map(function (ydate2) {
173-
let date82 = ydate2[reply.fetchedData.headers.findIndex(jk=>jk.name=="pe")];
174-
let data82 = ydate2[reply.fetchedData.headers.findIndex(jk=>jk.name=="value")];
175-
let ondt = parseFloat(ydate2[reply.fetchedData.headers.findIndex(jk=>jk.name=="value")]);
172+
let date82 = ydate2[reply.fetchedData.headers.findIndex(jk => jk.name == "pe")];
173+
let data82 = ydate2[reply.fetchedData.headers.findIndex(jk => jk.name == "value")];
174+
let ondt = parseFloat(ydate2[reply.fetchedData.headers.findIndex(jk => jk.name == "value")]);
176175
ondatarr.push(ondt);
177176
theorigdate2.push(date82);
178177
let ydata2 = parseFloat(data82).toFixed(2);
@@ -188,8 +187,8 @@ const RRSummary = props => {
188187
reply.fetchedData.metaData.dimensions.pe.map(o_on_pe => {
189188
ot_rr_rows.map(rw => {
190189
let array12 = rw;
191-
if (array12[reply.fetchedData.headers.findIndex(jk=>jk.name=="pe")] === o_on_pe) {
192-
let findata2 = parseFloat(array12[reply.fetchedData.headers.findIndex(jk=>jk.name=="value")]);
190+
if (array12[reply.fetchedData.headers.findIndex(jk => jk.name == "pe")] === o_on_pe) {
191+
let findata2 = parseFloat(array12[reply.fetchedData.headers.findIndex(jk => jk.name == "value")]);
193192
finalondata2.push(findata2);
194193
xc1 = 0;
195194
} else xc1 = 1;
@@ -254,10 +253,10 @@ const RRSummary = props => {
254253
msg: reply?.fetchedData?.message || '',
255254
...reply
256255
}
257-
if (e_rr.msg.includes('aborted')) {
256+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
258257
props.history.go(0)
259258
}
260-
console.error(reply)
259+
console.error(scrr_url + " : ", reply)
261260
return e_rr
262261
setErr(e_rr);
263262
} else {
@@ -309,7 +308,7 @@ const RRSummary = props => {
309308
useEffect(() => {
310309
let mounted = true
311310
let u_r_l = endpoints[0][process.env.REACT_APP_ENV == "dev" ? "local_url" : "url"]
312-
let ftch = (r_l, scr_l) => {
311+
let ftch = (r_l, scr_l, nfp) => {
313312
fetchRR(r_l).then(dta => {
314313
// console.log('dta: ', dta)
315314
setLoading(false)
@@ -319,23 +318,24 @@ const RRSummary = props => {
319318
updateRRData(dta?.rr?.data, dta?.rr?.periods, dta?.rr?.orgs, null);
320319
updateOTRRData(dta?.ot?.data, dta?.ot?.periods, dta?.ot?.orgs, null);
321320
}
321+
}).then(r9t => {
322+
if (nfp?.ou != '~' && nfp?.ou != 'HfVjCurKxh2' && nfp?.ou != null) {
323+
// console.log('SHOW_LATEST')
324+
fetchScRR(scr_l).then((dt_a) => {
325+
let { data, period, orgs } = dt_a
326+
setLoading(false)
327+
if (data?.error && data?.msg) {
328+
setErr(data)
329+
} else {
330+
updateLatestSCRR(data, period, orgs, '')
331+
}
332+
});
333+
} else {
334+
// console.log('HIDE_LATEST:: nfp.ou :: ' + nfp?.ou)
335+
}
322336
});
323-
if(oun == null || oun == '~' || oun == "HfVjCurKxh2" || filter_params?.ou == '~' || filter_params?.ou == 'HfVjCurKxh2'){
324-
console.info('SHW SUMM')
325-
}else{
326-
console.info('NOT NATIONAL')
327-
fetchScRR(scr_l).then((dt_a) => {
328-
let {data, period, orgs} = dt_a
329-
setLoading(false)
330-
if (data?.error && data?.msg) {
331-
setErr(data)
332-
} else {
333-
updateLatestSCRR(data, period, orgs, '')
334-
}
335-
});
336-
}
337337
}
338-
ftch(url, scurl)
338+
ftch(url, scurl, filter_params)
339339
if (mounted) {
340340

341341
props.history.listen((location, action) => {
@@ -367,13 +367,13 @@ const RRSummary = props => {
367367
setOulvl(new_filter_params.level);
368368
}
369369
let l_vl = '2'
370-
if(oun == null || oun == '~' || oun == "HfVjCurKxh2"){
370+
if (oun == null || oun == '~' || oun == "HfVjCurKxh2") {
371371
l_vl = '1'
372372
}
373373
let new_url = filterUrlConstructor(
374374
new_filter_params.pe,
375375
new_filter_params.ou,
376-
l_vl,
376+
"~", //l_vl,
377377
base_rr_url
378378
);
379379
let new_scurl = filterUrlConstructor(
@@ -382,8 +382,7 @@ const RRSummary = props => {
382382
'3',
383383
base_scrr_url
384384
);
385-
ftch(new_url);
386-
ftch(new_scurl);
385+
ftch(new_url, new_scurl, new_filter_params);
387386
}
388387
});
389388
}
@@ -398,7 +397,7 @@ const RRSummary = props => {
398397
// console.log('period_s: ', JSON.stringify(period_s))
399398
// console.log('otrrdata: ', JSON.stringify(otrrdata))
400399
// console.log('rrdata: ', JSON.stringify(rrdata))
401-
400+
402401
let trnd = {}
403402
trnd.pe = period_s
404403
trnd.ot = otrrdata

src/views/StockStatus/StockStatusAll.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const StockStatusAll = props => {
8080
...reply
8181
}
8282
setErr(e_rr);
83-
if (e_rr.msg.includes('aborted')) {
83+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
8484
props.history.go(0)
8585
}
8686
} else {

src/views/StockStatus/StockStatusMap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const StockStatusMap = props => {
8383
...reply
8484
}
8585
setErr(e_rr);
86-
if (e_rr.msg.includes('aborted')) {
86+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
8787
props.history.go(0)
8888
}
8989
} else {

src/views/StockStatus/StockStatusOne.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const StockStatusOne = props => {
9393
...reply
9494
}
9595
setErr(e_rr);
96-
if (e_rr.msg.includes('aborted')) {
96+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
9797
props.history.go(0)
9898
}
9999
} else {

src/views/SupplyChain/SCSummary.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const SCSummary = props => {
8585
...reply
8686
}
8787
setErr(e_rr);
88-
if (e_rr.msg.includes('aborted')) {
88+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
8989
props.history.go(0)
9090
}
9191
} else {

src/views/SupplyChain/SCTrends.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const SCTrends = props => {
9090
...reply
9191
}
9292
setErr(e_rr);
93-
if (e_rr.msg.includes('aborted')) {
93+
if (e_rr.msg.includes('aborted') || e_rr.msg.includes('NetworkError')) {
9494
props.history.go(0)
9595
}
9696
} else {

0 commit comments

Comments
 (0)