web: update readme, remove dead code

This commit is contained in:
radex 2024-07-08 22:50:27 +02:00
parent f5d4c0c6e1
commit c81a906e28
Signed by: radex
SSH key fingerprint: SHA256:hvqRXAGG1h89yqnS+cyFTLKQbzjWD4uXIqw7Y+0ws30
5 changed files with 4 additions and 30 deletions

3
.gitignore vendored
View file

@ -1,6 +1,5 @@
olddata
webapp/data.db
web/webapp/data.db
**/data.db
*pyc
*sublime*
kasownik.ini

View file

@ -5,7 +5,7 @@ cache_dir=/path/to/cache/folder
lockfile=/path/to/kasownik.lock
[database]
uri=sqlite:///./pekaobiznes.sqlite3
uri=sqlite:///../data.db
[scraper]
tdid=...trusted_device_id...

View file

@ -2,7 +2,7 @@
## Quick start (old school)
1. [Register new SSO application](https://sso.hackerspace.pl/client/create) - client name and URI don't matter, redirect URI should be `http://localhost:5000/oauth/callback` (by default), other settings can stay default.
1. [Register new SSO application](https://sso.hackerspace.pl/client/create) - client name and URI don't matter, redirect URI should be `http://localhost:5000/oauth/callback` (by default), enable `profile:read` scope; other settings can stay default.
2. ```sh
pip install -r requirements.txt
# (set up database, one time)

View file

@ -4,7 +4,7 @@ env = environs.Env()
env.read_env()
DEBUG = env.bool("DEBUG", False)
SQLALCHEMY_DATABASE_URI = env.str("SQLALCHEMY_DATABASE_URI", "sqlite:///data.db")
SQLALCHEMY_DATABASE_URI = env.str("SQLALCHEMY_DATABASE_URI", "sqlite:///../../data.db")
DUMMY_TRANSFER_UID = "NOTAMEMBER"
SPACEAUTH_CONSUMER_KEY = env.str("SPACEAUTH_CONSUMER_KEY", "kasownik")

View file

@ -74,29 +74,6 @@ def _public_api_method(path):
return decorator2
@cache.memoize()
def _stats_for_month(year, month):
# TODO: export this to the config
money_required = 4217 + 615 + 615
money_paid = 0
mts = (
models.MemberTransfer.query.filter_by(year=year, month=month)
.join(models.MemberTransfer.transfer)
.all()
)
for mt in mts:
amount_all = mt.transfer.amount
amount = amount_all / len(mt.transfer.member_transfers)
money_paid += amount
return money_required, money_paid / 100
@_public_api_method("month/<year>/<month>")
def api_month(year=None, month=None):
money_required, money_paid = _stats_for_month(year, month)
return dict(required=money_required, paid=money_paid)
@_public_api_method("judgement/<membername>")
def api_judgement(membername):
member = models.Member.query.filter_by(username=membername).first()
@ -115,8 +92,6 @@ def api_months_due(membername):
year, month = member.get_last_paid()
if not year:
raise APIError("Member never paid.", 402)
if year and member.active == False and member.username == "b_rt":
raise APIError("Stoned.", 420)
if year and member.active == False:
raise APIError("No longer a member.", 410)
due = member.get_months_due()