name change from appendLedger to insertData
This commit is contained in:
+15
-5
@@ -23,7 +23,7 @@ def openDatabase(database):
|
||||
|
||||
return conn
|
||||
|
||||
def appendLedger(conn, table, values):
|
||||
def insertData(conn, table, values):
|
||||
"""
|
||||
add values to sqlite3 database
|
||||
"""
|
||||
@@ -32,9 +32,19 @@ def appendLedger(conn, table, values):
|
||||
c.execute('INSERT INTO {} VALUES ({})'.format(table, holders), values)
|
||||
conn.commit()
|
||||
|
||||
def sanatizeTotals(values):
|
||||
"""
|
||||
checks cells and replaces empty string with 0
|
||||
"""
|
||||
|
||||
def sanatizeWorkarea(values):
|
||||
"""
|
||||
checks indexes 6+ and replaces empty string with 0
|
||||
"""
|
||||
|
||||
def extractDsw(srcSheet, conn, reportDate):
|
||||
"""
|
||||
get dsw data from srcSheet and call appendLedger with values
|
||||
get dsw data from srcSheet and call insertData with values
|
||||
"""
|
||||
# we dont extract data until we find a particular spot in the worksheet
|
||||
# there may be a search or other better way to do this
|
||||
@@ -51,7 +61,7 @@ def extractDsw(srcSheet, conn, reportDate):
|
||||
srcSheet.cell(i,14).value, srcSheet.cell(i,20).value,
|
||||
srcSheet.cell(i,18).value, srcSheet.cell(i,32).value,
|
||||
srcSheet.cell(i,33).value, srcSheet.cell(i,34).value)
|
||||
appendLedger(conn, 'totals', values)
|
||||
insertData(conn, 'totals', values)
|
||||
i += 1
|
||||
values = ('terminal', reportDate, srcSheet.cell(i,6).value,
|
||||
srcSheet.cell(i,7).value, srcSheet.cell(i,8).value,
|
||||
@@ -60,7 +70,7 @@ def extractDsw(srcSheet, conn, reportDate):
|
||||
srcSheet.cell(i,14).value, srcSheet.cell(i,20).value,
|
||||
srcSheet.cell(i,18).value, srcSheet.cell(i,32).value,
|
||||
srcSheet.cell(i,33).value, srcSheet.cell(i,34).value)
|
||||
appendLedger(conn, 'totals', values)
|
||||
insertData(conn, 'totals', values)
|
||||
#we're done so exit
|
||||
break
|
||||
# get the individual route totals, need to figure a way to get skip double trip lines and get times for drivers on same
|
||||
@@ -79,7 +89,7 @@ def extractDsw(srcSheet, conn, reportDate):
|
||||
srcSheet.cell(i,12).value, srcSheet.cell(i,2).value,
|
||||
srcSheet.cell(i,24).value, srcSheet.cell(i,13).value,
|
||||
srcSheet.cell(i,19).value, srcSheet.cell(i,17).value)
|
||||
appendLedger(conn, 'dsw', values)
|
||||
insertData(conn, 'dsw', values)
|
||||
if 'Svc' in srcSheet.cell(i,0).value:
|
||||
extract = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user