-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Superstar emails and report page
Fixes https://magfest.atlassian.net/browse/MAGDEV-1314 and fixes https://magfest.atlassian.net/browse/MAGDEV-1138. The receipt and intro emails are separate due to the fact that people can donate multiple times.
- Loading branch information
Showing
6 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,15 @@ def __init__(self, event): | |
when=days_before(7, c.EPOCH), | ||
sender='MAGFest <[email protected]>') | ||
|
||
AutomatedEmailFixture( | ||
Attendee, 'Thank you for your Super MAGFest Superstars Donation!', | ||
'superstar_intro.html', | ||
filter=lambda a: a.extra_donation >= c.SUPERSTAR_MINIMUM and a.active_receipt and not a.amount_unpaid, | ||
ident='superstar_intro', | ||
when=before(c.SUPERSTAR_DEADLINE), | ||
sender='MAGFest Superstar Program <[email protected]>' | ||
) | ||
|
||
AutomatedEmailFixture( | ||
Attendee, 'MAGFest food for guests', 'guest_food_restrictions.txt', | ||
lambda a: a.badge_type == c.GUEST_BADGE, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from collections.abc import Mapping | ||
from datetime import timedelta, datetime | ||
import pytz | ||
from time import sleep, time | ||
import traceback | ||
|
||
from celery.schedules import crontab | ||
from pockets import groupify, listify | ||
from pockets.autolog import log | ||
from sqlalchemy.orm import joinedload | ||
|
||
from uber import utils | ||
from uber.amazon_ses import email_sender | ||
from uber.automated_emails import AutomatedEmailFixture | ||
from uber.config import c | ||
from uber.decorators import render | ||
from uber.models import AutomatedEmail, Email, MagModel, Attendee, Session, ReceiptItem, ModelReceipt | ||
from uber.tasks import celery | ||
from uber.tasks.email import send_email | ||
|
||
|
||
@celery.schedule(crontab(minute=0, hour=0)) | ||
def superstar_receipts(): | ||
with Session() as session: | ||
extra_donations = session.query(ReceiptItem).join(ModelReceipt).filter( | ||
ReceiptItem.desc.contains("Extra Donation"), ReceiptItem.closed != None, ReceiptItem.amount > 0, | ||
ModelReceipt.owner_model == "Attendee") | ||
for donation in extra_donations: | ||
attendee = session.query(Attendee).filter(Attendee.id == donation.receipt.owner_id).first() | ||
if not attendee.amount_unpaid: | ||
closed_local = donation.closed.astimezone(c.EVENT_TIMEZONE).strftime('%x_%X') | ||
ident = f'superstar_receipt_{int(donation.amount / 100)}_{closed_local}' | ||
already_emailed = session.query(Email.ident).filter(Email.ident == ident, | ||
Email.fk_id == attendee.id).first() | ||
if not already_emailed: | ||
subject = f"MAGFest {c.EVENT_YEAR} Superstar Donation Receipt" | ||
body = render('emails/superstar_receipt.html', {'donation': donation, 'attendee': attendee}, | ||
encoding=None) | ||
send_email("MAGFest Superstar Program <[email protected]>", attendee.email_to_address, | ||
subject, body, format='html', model=attendee.to_dict('id'), ident=ident) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<html> | ||
<head></head> | ||
<body> | ||
<p> | ||
Dear {{ attendee.full_name }}, | ||
<br/>On behalf of our Board of Directors, employees, and volunteer staff, thank you for becoming a MAGFest Superstar! Your contribution helps support our mission to make the world a better place through video games. | ||
</p> | ||
<p> | ||
MAGFest, Inc. has been achieving this mission through numerous events, such as Super MAGFest, MAGWest, MAGStock, and Bit Gen Gamer Fest, and by building and empowering a huge community of volunteers, partners, and participants. MAGFest supports this community by highlighting VGM musicians, indie developers, and creatives, as well as uniting those who are eager to relive nostalgia with those who mutually appreciate videogames. In recent years, we have also launched the MAGScouts initiative, which highlights family-friendly content throughout the event, and have increased our educational offerings in Makerspace, Jam Clinic, Panels and more. | ||
</p> | ||
<p> | ||
With your donation, you are helping us to grow these events, create new content, educate more people about video game music, art, and history, and you are also supporting the continued preservation of video game culture and history. If you are interested in learning more about how you can continue supporting our mission, please reach out to us at {{ '[email protected]'|email_to_link }}, and look out for another email in the coming weeks about fulfilling your Superstars perks for MAGFest {{ c.EVENT_YEAR }}! | ||
</p> | ||
<p> | ||
You should receive an email as an official receipt for tax purposes, titled "MAGFest {{ c.EVENT_YEAR }} Superstar Donation Receipt." | ||
If you donated multiple times (e.g., you upgraded an existing donation), you'll receive one email for each time you donated. | ||
</p> | ||
<p>Thank you again for your thoughtful and generous contribution.</p> | ||
<p> | ||
Sincerely, | ||
<br/><br/>Christina Ralls | ||
<br/>Director of Business and Development | ||
<br/>MAGFest, Inc. | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<html> | ||
<head></head> | ||
<body> | ||
<p> | ||
Dear {{ attendee.full_name }}, | ||
<br/>Thank you for donating to {{ c.EVENT_NAME_AND_YEAR }}! | ||
</p> | ||
<p> | ||
Please accept this email as an official receipt for tax purposes: | ||
<br/>Amount: {{ (donation.amount / 100)|format_currency }} | ||
<br/>Date: {{ donation.closed|full_datetime_local }} | ||
<br/>Total Donated: {{ attendee.extra_donation|format_currency }}<em class="text-muted">*</em> | ||
<br/><span class="text-muted form-text">*The total donations associated with your {{ c.EVENT_NAME_AND_YEAR }} registration. Does not include donations to {{ c.ORGANIZATION_NAME }} from other sources or at other events.</span> | ||
</p> | ||
<p> | ||
Sincerely, | ||
<br/><br/>Christina Ralls | ||
<br/>Director of Business and Development | ||
<br/>MAGFest, Inc. | ||
</p> | ||
</body> | ||
</html> |