forked from fram3d/donationcalc
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
112322e589 | |||
efb4813c5d | |||
2e46574c22 | |||
96c3ae4066 | |||
d791adcb95 | |||
6c82abd35b |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
venv/
|
venv/
|
||||||
donationcalc/__pycache__/
|
donationcalc/__pycache__/
|
||||||
donors.txt
|
|
||||||
|
@ -4,7 +4,7 @@ Priority: optional
|
|||||||
Architecture: all
|
Architecture: all
|
||||||
Essential: no
|
Essential: no
|
||||||
Installed-Size: 2000
|
Installed-Size: 2000
|
||||||
Depends: python3-flask
|
Depends: python3-flask, gunicorn
|
||||||
Homepage: https://gitea.dmz.rs/fram3d/donationcalc
|
Homepage: https://gitea.dmz.rs/fram3d/donationcalc
|
||||||
Maintainer: fram3d <fram3d@dmz.rs>
|
Maintainer: fram3d <fram3d@dmz.rs>
|
||||||
Description: Web app that tracks donations and notifies users via email
|
Description: Web app that tracks donations and notifies users via email
|
||||||
|
4
build-deb/donationcalc/DEBIAN/postinst
Normal file → Executable file
4
build-deb/donationcalc/DEBIAN/postinst
Normal file → Executable file
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
/usr/bin/echo "Adding monthly rebalance to crontab"
|
/usr/bin/echo "Adding monthly rebalance to crontab"
|
||||||
/usr/bin/crontab -l > /tmp/donationcalccrontab.tmp
|
/usr/bin/crontab -l > /tmp/donationcalccrontab.tmp
|
||||||
/usr/bin/echo "0 0 1 * * /usr/bin/python3 /var/donationcalc/run.py -r" >> /tmp/donationcalccrontab.tmp
|
/usr/bin/echo "0 0 1 * * /usr/bin/python3 /var/donationcalc/rebalance.py" >> /tmp/donationcalccrontab.tmp
|
||||||
/usr/bin/crontab /tmp/donationcalccrontab.tmp
|
/usr/bin/crontab /tmp/donationcalccrontab.tmp
|
||||||
/usr/bin/rm /tmp/donationcalccrontab.tmp
|
/usr/bin/rm /tmp/donationcalccrontab.tmp
|
||||||
|
/usr/bin/systemctl enable donationcalc.service
|
||||||
|
/sbin/service donationcalc start
|
||||||
|
4
build-deb/donationcalc/DEBIAN/prerm
Normal file → Executable file
4
build-deb/donationcalc/DEBIAN/prerm
Normal file → Executable file
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
/usr/bin/echo "Removing monthly rebalance to crontab"
|
/usr/bin/echo "Removing monthly rebalance to crontab"
|
||||||
/usr/bin/crontab -l > /tmp/donationcalccrontab.tmp
|
/usr/bin/crontab -l > /tmp/donationcalccrontab.tmp
|
||||||
/usr/bin/grep -v "0 0 1 * * /usr/bin/python3 /var/donationcalc/run.py -r" /tmp/donationcalccrontab.tmp >> /tmp/donationcalccrontab.tmp1
|
/usr/bin/grep -v "0 0 1 * * /usr/bin/python3 /var/donationcalc/rebalance.py" /tmp/donationcalccrontab.tmp >> /tmp/donationcalccrontab.tmp1
|
||||||
/usr/bin/crontab /tmp/donationcalccrontab.tmp1
|
/usr/bin/crontab /tmp/donationcalccrontab.tmp1
|
||||||
/usr/bin/rm /tmp/donationcalccrontab.tmp /tmp/donationcalccrontab.tmp1
|
/usr/bin/rm /tmp/donationcalccrontab.tmp /tmp/donationcalccrontab.tmp1
|
||||||
|
/sbin/service donationcalc stop
|
||||||
|
/usr/bin/systemdctl disable donationcalc.service
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="sr">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="/styles/reset.css">
|
||||||
|
<link rel="stylesheet" href="/styles/style.css">
|
||||||
|
<link rel="stylesheet" href="/styles/donation.css">
|
||||||
|
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
|
||||||
<title>Subscribe for donation reminders</title>
|
<title>Subscribe for donation reminders</title>
|
||||||
<style>
|
<style>
|
||||||
.container {
|
.container {
|
||||||
|
0
donors.txt
Normal file
0
donors.txt
Normal file
16
rebalance.py
Executable file
16
rebalance.py
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
from donationcalc import donationconfig
|
||||||
|
import donationcalc.models
|
||||||
|
|
||||||
|
donconf = donationconfig.donationconfig()
|
||||||
|
donconf.rebalance()
|
||||||
|
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)
|
37
run.py
37
run.py
@ -1,31 +1,16 @@
|
|||||||
from donationcalc import app
|
|
||||||
from donationcalc import donationconfig
|
from donationcalc import donationconfig
|
||||||
import donationcalc.models
|
import donationcalc.models
|
||||||
import argparse
|
|
||||||
|
|
||||||
def parseArgs(parser):
|
donconf = donationconfig.donationconfig()
|
||||||
parser.add_argument("-r", "--rebalance", dest = "rebalance", help = "balance the monthly values", action="store_true")
|
donconf.rebalance()
|
||||||
return parser.parse_args()
|
sender = donationcalc.models.sender()
|
||||||
|
donors = []
|
||||||
|
f = open("donors.txt", "r")
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
for line in f.readlines():
|
||||||
args = parseArgs(parser)
|
linesplit = line.split(",")
|
||||||
|
newdonor = donationcalc.models.donor(email = linesplit[0], monthly = linesplit[1])
|
||||||
|
donors.append(newdonor)
|
||||||
|
f.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
donationcalc.models.rebalanceall(sender,donors)
|
||||||
|
|
||||||
if args.rebalance:
|
|
||||||
donconf = donationconfig.donationconfig()
|
|
||||||
donconf.rebalance()
|
|
||||||
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)
|
|
||||||
exit()
|
|
||||||
|
|
||||||
app.run(debug=False)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user