donationcalc/run.py

32 lines
906 B
Python
Raw Normal View History

2023-07-13 14:49:27 +00:00
from donationcalc import app
from donationcalc import donationconfig
2023-07-13 15:50:33 +00:00
import donationcalc.models
2023-07-13 14:49:27 +00:00
import argparse
def parseArgs(parser):
parser.add_argument("-r", "--rebalance", dest = "rebalance", help = "balance the monthly values", action="store_true")
return parser.parse_args()
parser = argparse.ArgumentParser()
args = parseArgs(parser)
if __name__ == '__main__':
if args.rebalance:
donconf = donationconfig.donationconfig()
donconf.rebalance()
2023-07-13 15:50:33 +00:00
sender = donationcalc.models.sender()
donors = []
f = open("donors.txt", "r")
for line in f.readlines():
linesplit = line.split(",")
newdonor = donationcalc.models.donor(email = linesplit[0], monthly = linesplit[1])
donors.append(newdonor)
f.close()
donationcalc.models.rebalanceall(sender,donors)
2023-07-13 14:49:27 +00:00
exit()
app.run(debug=False)