Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Project
/
eis_sipkd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 269622d5
authored
Aug 24, 2017
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
chart
1 parent
57e2e9d2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
scripts/calculate_data.py
scripts/calculate_data.py
View file @
269622d
...
...
@@ -6,16 +6,17 @@ def has_child(DBS, table, kode): #TODO filter parameterized
return
row
def
calculate_data
(
DBS
,
table
):
qry
=
DBS
.
query
(
table
)
.
order_by
(
table
.
kode
)
rows
=
qry
.
all
()
parents
=
[]
results
=
[]
jml
=
0
for
row
in
rows
:
if
has_child
(
DBS
,
table
,
row
.
kode
):
parents
.
append
(
dict
(
id
=
row
.
id
,
kode
=
row
.
kode
,
jumlah
=
0
))
kode
=
row
.
kode
jml
=
0
else
:
if
row
.
jumlah
:
jml
=
jml
+
row
.
jumlah
pass
# qry = DBS.query(table).order_by(table.kode)
# rows = qry.all()
# parents = []
# results = []
# jml = 0
# for row in rows:
# if has_child(DBS, table, row.kode):
# parents.append(dict(id = row.id, kode=row.kode, jumlah=0))
# kode = row.kode
# jml = 0
# else:
# if row.jumlah:
# jml = jml + row.jumlah
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment