Refactor data extraction in Views class to use mapping for improved clarity and reliability

1 parent 94cd41d0
......@@ -173,11 +173,12 @@ class Views(BaseView):
dailyAccTrx = []
amt = trx = acc = accTrx = 0
for r in qry:
step = r[3]
bayar = r[0] or 0
denda = r[1] or 0
mapped = r._mapping
step = r.get(step,"")
bayar = r.get("bayar", 0)
denda = r.get("denda", 0)
pokok = bayar - denda
tx = r[2] or 0
tx = r.get("trx",0)
daily.append((step, pokok))
dailyTrx.append((step, tx))
acc += pokok
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!