File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ class Widget extends DmYY {
104104 ) ;
105105 console . log ( response ) ;
106106 this . settings . data = [ ] ;
107- response . forEach ( ( dataInfo ) => {
107+ response ? .forEach ( ( dataInfo ) => {
108108 const dataSource = {
109109 user : '**' ,
110110 left : {
@@ -133,13 +133,13 @@ class Widget extends DmYY {
133133 dataSource . left . arrearsOfFees = dataInfo . arrearsOfFees ;
134134
135135 dataSource . right . previousBill = parseFloat (
136- this . last ( dataInfo . monthElecQuantity . mothEleList ) . monthEleCost
136+ this . last ( dataInfo . monthElecQuantity ?. mothEleList || [ ] )
137+ ?. monthEleCost || 0
137138 ) ;
138139
139- const oldVal = this . last (
140- dataInfo . monthElecQuantity . mothEleList ,
141- 2
142- ) . monthEleCost ;
140+ const oldVal =
141+ this . last ( dataInfo . monthElecQuantity ?. mothEleList || [ ] , 2 )
142+ ?. monthEleCost || 1 ;
143143
144144 dataSource . right . previousBillRate =
145145 ( ( dataSource . right . previousBill - oldVal ) / oldVal ) * 100 ;
@@ -149,7 +149,7 @@ class Widget extends DmYY {
149149 ) ;
150150
151151 dataSource . right . thisYear = parseFloat (
152- dataInfo . monthElecQuantity . dataInfo . totalEleCost
152+ dataInfo . monthElecQuantity ? .dataInfo ? .totalEleCost || 0
153153 ) ;
154154
155155 const lastYearVal = dataInfo . lastYearElecQuantity . dataInfo . totalEleCost ;
You can’t perform that action at this time.
0 commit comments