From 18a1dcb0d11a6983dce7f17499777b36d466076f Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Thu, 14 Dec 2023 18:32:09 -0500 Subject: [PATCH 1/4] Enable setting discord link via config Also makes it super easy to turn on/off the discord button, if the DISCORD_LINK configuration option is undefined, it'll show a little message that discord is still under construction --- goathacks/templates/dashboard.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/goathacks/templates/dashboard.html b/goathacks/templates/dashboard.html index 26680c6..44c9656 100644 --- a/goathacks/templates/dashboard.html +++ b/goathacks/templates/dashboard.html @@ -30,10 +30,13 @@ Forgot to upload your resume while registering? No worries, submit it below.
+ {% if config['DISCORD_LINK'] is defined %}
Make sure to join the Discord and enter your shirt size below!
-

(Please note that due to COVID-19 constraints, we can't guarantee that all participants will receive Hack@WPI t-shirts this year but we are trying to find a way!)

- Discord + {% else %} +
Our discord is still under construction! We'll send out an email when it's ready.
+ {% endif %}
-- 2.43.5 From a2e640f8f7668a14ccd6910ff6cb792603eac64e Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Thu, 14 Dec 2023 19:05:58 -0500 Subject: [PATCH 2/4] Update CLI Add the following user commands: - list - autopromote List will list all users as a table, useful for debugging things without pulling out the database or the admin page Autopromote will automatically promote and email users off the waitlist until capacity is reached --- goathacks/cli.py | 55 +++++++++++++++++++++++++++++++++++++ goathacks/config.py.example | 2 ++ requirements.txt | 1 + 3 files changed, 58 insertions(+) diff --git a/goathacks/cli.py b/goathacks/cli.py index 340af87..e4a56ba 100644 --- a/goathacks/cli.py +++ b/goathacks/cli.py @@ -9,6 +9,8 @@ from goathacks.registration import bp from goathacks import db, mail from goathacks.models import User +from tabulate import tabulate + gr = AppGroup("user") @gr.command('create') @@ -122,3 +124,56 @@ def drop_user(email, confirm): db.session.commit() click.echo(f"Dropped {user.first_name}'s registration") +@gr.command("list") +def list_users(): + """ + Gets a list of all users + """ + users = User.query.all() + + def make_table_content(user): + return [user.email, f"{user.first_name} {user.last_name}", user.waitlisted, user.is_admin] + + table = map(make_table_content, users) + + print(tabulate(table, headers=["Email", "Name", "Waitlisted", "Admin"])) + + +@gr.command("autopromote") +def autopromote_users(): + """ + Runs through and automatically promotes users up to the waitlist limit + """ + WAITLIST_LIMIT = current_app.config['MAX_BEFORE_WAITLIST'] + num_confirmed = db.session.query(User).filter(User.waitlisted == False).count() + click.echo(f"Got {num_confirmed} confirmed attendees") + num_waitlisted = db.session.query(User).filter(User.waitlisted == True).count() + click.echo(f"Got {num_waitlisted} waitlisted attendees") + + num_to_promote = WAITLIST_LIMIT - num_confirmed + + if num_to_promote > num_waitlisted: + num_to_promote = num_waitlisted + + click.echo(f"About to promote {str(num_to_promote)} attendees from waitlist") + + users = db.session.query(User).filter(User.waitlisted == True).all() + + num_promoted = 0 + num_to_promote_orig = num_to_promote + + for u in users: + if num_to_promote > 0: + click.echo(f"Attempting to promote {u.email} ({u.id})") + u.waitlisted = False + db.session.commit() + msg = Message("Waitlist Promotion") + msg.add_recipient(u.email) + msg.sender = ("GoatHacks Team", "hack@wpi.edu") + msg.body = render_template("emails/waitlist_promotion.txt", user=u) + mail.send(msg) + num_promoted += 1 + num_to_promote -= 1 + + click.echo(f"Promoted {num_promoted}/{num_to_promote_orig} attendees off the waitlist!") + diff --git a/goathacks/config.py.example b/goathacks/config.py.example index f9421b0..fb85c63 100644 --- a/goathacks/config.py.example +++ b/goathacks/config.py.example @@ -4,6 +4,8 @@ SECRET_KEY="bad-key-change-me" UPLOAD_FOLDER="./uploads/" +DISCORD_LINK=None + # Mail settings MAIL_SERVER="localhost" diff --git a/requirements.txt b/requirements.txt index efbd546..8c7a041 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,3 +23,4 @@ uWSGI==2.0.21 Werkzeug==2.2.2 WTForms==3.0.1 ulid +tabulate -- 2.43.5 From f82aa08085a7c5387a887e4a41c39bd05302958d Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Thu, 14 Dec 2023 21:14:50 -0500 Subject: [PATCH 3/4] Update static site --- .gitmodules | 2 +- goathacks/templates/home | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 807cb70..24175f7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "goathacks/templates/home"] path = goathacks/templates/home url = https://github.com/WPI-ACM/Hack-WPI-Static - branch = 2023-dev + branch = master diff --git a/goathacks/templates/home b/goathacks/templates/home index fba5946..e0fb69c 160000 --- a/goathacks/templates/home +++ b/goathacks/templates/home @@ -1 +1 @@ -Subproject commit fba594664faeb8b6056462a0f8bc79a0d21a3768 +Subproject commit e0fb69c0be54c6cce7391ccb86a9bf14b80f432b -- 2.43.5 From ede69a3be6acb96f625f30b81aa9d1bfc9333ab6 Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Thu, 11 Jan 2024 14:27:47 -0500 Subject: [PATCH 4/4] Make qrcode generator create external URLs --- goathacks/templates/events/qrcode.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/goathacks/templates/events/qrcode.html b/goathacks/templates/events/qrcode.html index ce48b9e..7c0d035 100644 --- a/goathacks/templates/events/qrcode.html +++ b/goathacks/templates/events/qrcode.html @@ -2,5 +2,6 @@ QR Code for {{ event.name }} - + -- 2.43.5