diff --git a/flaskfdx/tools/fdxsql.py b/flaskfdx/tools/fdxsql.py index e12b79e..35a5f95 100644 --- a/flaskfdx/tools/fdxsql.py +++ b/flaskfdx/tools/fdxsql.py @@ -1,6 +1,8 @@ #!/bin/python """ process fdx excel files into existing sqlite3 database +processREPORTNAME functions all expect a file and database connection +as arguments and return a date and error message if there is one standalone usage fdxtools TYPE INFILE DATABASE where TYPE is the report type, ie dsw, INFILE is an excel file, DATABASE is an sqlite file """ @@ -114,10 +116,10 @@ def processDsw(file, database): # check if records already exist and then add records if not if checkDate(database, reportDate): - print("we have already processed " + reportDate) + return reportDate, "we have already processed " + reportDate else: extractDsw(srcSheet, database, reportDate) - + return reportDate, None def main(): # get filename and database rom cmdline @@ -133,7 +135,11 @@ def main(): sys.exit('database could not be opened, does it exist') if args.type == 'dsw': - processDsw(args.inFile, conn) + date, error = processDsw(args.inFile, conn) + if not error: + print(date) + else: + print(error) else: print('type not found or not entered')