Commit 269622d5 by aa.gusti

chart

1 parent 57e2e9d2
...@@ -6,16 +6,17 @@ def has_child(DBS, table, kode): #TODO filter parameterized ...@@ -6,16 +6,17 @@ def has_child(DBS, table, kode): #TODO filter parameterized
return row return row
def calculate_data(DBS, table): def calculate_data(DBS, table):
qry = DBS.query(table).order_by(table.kode) pass
rows = qry.all() # qry = DBS.query(table).order_by(table.kode)
parents = [] # rows = qry.all()
results = [] # parents = []
jml = 0 # results = []
for row in rows: # jml = 0
if has_child(DBS, table, row.kode): # for row in rows:
parents.append(dict(id = row.id, kode=row.kode, jumlah=0)) # if has_child(DBS, table, row.kode):
kode = row.kode # parents.append(dict(id = row.id, kode=row.kode, jumlah=0))
jml = 0 # kode = row.kode
else: # jml = 0
if row.jumlah: # else:
jml = jml + row.jumlah # if row.jumlah:
# jml = jml + row.jumlah
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!