@@ -45,14 +45,14 @@ const RRSummary = props => {
45
45
ep => ep . id == 'county__reporting_rate_trend'
46
46
) [ process . env . REACT_APP_ENV == "dev" ? "local_url" : "url" ] ;
47
47
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' ) {
49
49
lv_l = '1'
50
50
}
51
51
let [ url , setUrl ] = useState (
52
52
filterUrlConstructor (
53
53
'LAST_6_MONTHS' ,
54
54
filter_params . ou ,
55
- lv_l ,
55
+ "~" , // lv_l,
56
56
base_rr_url
57
57
)
58
58
) ;
@@ -68,7 +68,7 @@ const RRSummary = props => {
68
68
const [ latestScRR , setLatestScRR ] = useState ( [ [ ] ] ) ;
69
69
const [ ScRRpe , setScRRpe ] = useState ( '' ) ;
70
70
const [ scrrSubcounties , setScRRsubcs ] = useState ( [ [ ] ] ) ;
71
-
71
+
72
72
const [ err , setErr ] = useState ( { error : false , msg : '' } ) ;
73
73
let title = `Reporting Rate: Summary` ;
74
74
@@ -104,11 +104,10 @@ const RRSummary = props => {
104
104
msg : reply ?. fetchedData ?. message || '' ,
105
105
...reply
106
106
}
107
- if ( e_rr . msg . includes ( 'aborted' ) ) {
107
+ if ( e_rr . msg . includes ( 'aborted' ) || e_rr . msg . includes ( 'NetworkError' ) ) {
108
108
props . history . go ( 0 )
109
109
}
110
- console . error ( "iko shida" )
111
- console . error ( reply )
110
+ console . error ( rr_url + " : " , reply )
112
111
return e_rr
113
112
setErr ( e_rr )
114
113
} else {
@@ -132,8 +131,8 @@ const RRSummary = props => {
132
131
133
132
////////////// rr ////////////////
134
133
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" ) ] ;
137
136
theorigdate . push ( date8 ) ;
138
137
let ydata = parseFloat ( data8 ) . toFixed ( 2 ) ;
139
138
matched_data . push ( ydata ) ;
@@ -147,9 +146,9 @@ const RRSummary = props => {
147
146
reply . fetchedData . metaData . dimensions . pe . map ( o_rr_pe => {
148
147
rr_rows . map ( ( rw ) => {
149
148
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" ) ] ;
153
152
finalRRdata . push ( findata ) ;
154
153
xc = 0 ;
155
154
} else xc = 1 ;
@@ -170,9 +169,9 @@ const RRSummary = props => {
170
169
let matched_data2 = [ ] ;
171
170
let ondatarr = [ ] ;
172
171
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" ) ] ) ;
176
175
ondatarr . push ( ondt ) ;
177
176
theorigdate2 . push ( date82 ) ;
178
177
let ydata2 = parseFloat ( data82 ) . toFixed ( 2 ) ;
@@ -188,8 +187,8 @@ const RRSummary = props => {
188
187
reply . fetchedData . metaData . dimensions . pe . map ( o_on_pe => {
189
188
ot_rr_rows . map ( rw => {
190
189
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" ) ] ) ;
193
192
finalondata2 . push ( findata2 ) ;
194
193
xc1 = 0 ;
195
194
} else xc1 = 1 ;
@@ -254,10 +253,10 @@ const RRSummary = props => {
254
253
msg : reply ?. fetchedData ?. message || '' ,
255
254
...reply
256
255
}
257
- if ( e_rr . msg . includes ( 'aborted' ) ) {
256
+ if ( e_rr . msg . includes ( 'aborted' ) || e_rr . msg . includes ( 'NetworkError' ) ) {
258
257
props . history . go ( 0 )
259
258
}
260
- console . error ( reply )
259
+ console . error ( scrr_url + " : " , reply )
261
260
return e_rr
262
261
setErr ( e_rr ) ;
263
262
} else {
@@ -309,7 +308,7 @@ const RRSummary = props => {
309
308
useEffect ( ( ) => {
310
309
let mounted = true
311
310
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 ) => {
313
312
fetchRR ( r_l ) . then ( dta => {
314
313
// console.log('dta: ', dta)
315
314
setLoading ( false )
@@ -319,23 +318,24 @@ const RRSummary = props => {
319
318
updateRRData ( dta ?. rr ?. data , dta ?. rr ?. periods , dta ?. rr ?. orgs , null ) ;
320
319
updateOTRRData ( dta ?. ot ?. data , dta ?. ot ?. periods , dta ?. ot ?. orgs , null ) ;
321
320
}
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
+ }
322
336
} ) ;
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
- }
337
337
}
338
- ftch ( url , scurl )
338
+ ftch ( url , scurl , filter_params )
339
339
if ( mounted ) {
340
340
341
341
props . history . listen ( ( location , action ) => {
@@ -367,13 +367,13 @@ const RRSummary = props => {
367
367
setOulvl ( new_filter_params . level ) ;
368
368
}
369
369
let l_vl = '2'
370
- if ( oun == null || oun == '~' || oun == "HfVjCurKxh2" ) {
370
+ if ( oun == null || oun == '~' || oun == "HfVjCurKxh2" ) {
371
371
l_vl = '1'
372
372
}
373
373
let new_url = filterUrlConstructor (
374
374
new_filter_params . pe ,
375
375
new_filter_params . ou ,
376
- l_vl ,
376
+ "~" , // l_vl,
377
377
base_rr_url
378
378
) ;
379
379
let new_scurl = filterUrlConstructor (
@@ -382,8 +382,7 @@ const RRSummary = props => {
382
382
'3' ,
383
383
base_scrr_url
384
384
) ;
385
- ftch ( new_url ) ;
386
- ftch ( new_scurl ) ;
385
+ ftch ( new_url , new_scurl , new_filter_params ) ;
387
386
}
388
387
} ) ;
389
388
}
@@ -398,7 +397,7 @@ const RRSummary = props => {
398
397
// console.log('period_s: ', JSON.stringify(period_s))
399
398
// console.log('otrrdata: ', JSON.stringify(otrrdata))
400
399
// console.log('rrdata: ', JSON.stringify(rrdata))
401
-
400
+
402
401
let trnd = { }
403
402
trnd . pe = period_s
404
403
trnd . ot = otrrdata
0 commit comments