Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slide reminder #113

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions postgresqleu/confreg/backendforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Meta:
'testers', 'talkvoters', 'staff', 'volunteers', 'checkinprocessors',
'asktshirt', 'askfood', 'asknick', 'asktwitter', 'askbadgescan', 'askshareemail', 'askphotoconsent',
'skill_levels', 'additionalintro', 'callforpapersintro', 'showvotes', 'callforpaperstags', 'sendwelcomemail', 'welcomemail',
'tickets', 'queuepartitioning', 'invoice_autocancel_hours', 'attendees_before_waitlist',
'tickets', 'queuepartitioning', 'invoice_autocancel_hours', 'attendees_before_waitlist', 'slide_upload_reminder_days',
'initial_common_countries', 'jinjaenabled']
widgets = {
'welcomemail': EmailTextWidget,
Expand All @@ -91,7 +91,7 @@ def fix_fields(self):
self.fields['notifyvolunteerstatus'].help_text = 'Notifications will be sent to {} whenever a volunteer makes changes to a slot.'.format(self.conference.notifyaddr)

fieldsets = [
{'id': 'base_info', 'legend': 'Basic information', 'fields': ['attendees_before_waitlist', 'invoice_autocancel_hours', 'notifyregs', 'notifysessionstatus', 'notifyvolunteerstatus', ]},
{'id': 'base_info', 'legend': 'Basic information', 'fields': ['attendees_before_waitlist', 'invoice_autocancel_hours', 'notifyregs', 'notifysessionstatus', 'notifyvolunteerstatus','slide_upload_reminder_days' ]},
{'id': 'welcomeandreg', 'legend': 'Welcome and registration', 'fields': ['sendwelcomemail', 'welcomemail', 'tickets', 'queuepartitioning', 'initial_common_countries']},
{'id': 'promo', 'legend': 'Website promotion', 'fields': ['promoactive', 'promotext', 'promopicurl']},
{'id': 'twitter', 'legend': 'Twitter settings', 'fields': ['twitter_timewindow_start', 'twitter_timewindow_end', 'twitter_postpolicy', ]},
Expand Down
53 changes: 53 additions & 0 deletions postgresqleu/confreg/management/commands/confreg_send_reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from postgresqleu.confreg.models import ConferenceRegistration
from postgresqleu.confreg.util import send_conference_mail, send_conference_notification

from django.db.models import F


class Command(BaseCommand):
help = 'Send conference reminders'
Expand Down Expand Up @@ -74,6 +76,22 @@ def handle(self, *args, **options):
whatstr.getvalue(),
)

for conference in Conference.objects.filter(enddate__lte=timezone.now(),
slide_upload_reminder_days__gt=0,
enddate=timezone.now().date() - F('slide_upload_reminder_days') * timedelta(days=1)):

# One transaction for each conference with sessions that have not uploaded slides, to send reminder
# relating to slides.
with transaction.atomic():
whatstr = StringIO()
self.remind_slides_submission(whatstr, conference)
if whatstr.tell():
send_conference_notification(
conference,
"Slide upload reminders sent",
whatstr.getvalue(),
)

def remind_pending_speakers(self, whatstr, conference):
# Remind speakers that are in pending status. But only the ones
# where we've actually sent the status emails, meaning the
Expand Down Expand Up @@ -264,3 +282,38 @@ def remind_empty_speakers(self, whatstr, conference):
spk.lastmodified = timezone.now()
spk.save()
whatstr.write("Reminded speaker {0} that their profile is empty\n".format(spk.name))

def remind_slides_submission(self, whatstr, conference):
# Send reminder to sessions speakers to upload their slides.
# after the conference ended.
sessions = (
ConferenceSession.objects.filter(conference=conference, status=1)
.extra(
select={
"has_slides": "EXISTS (SELECT 1 FROM confreg_conferencesessionslides WHERE session_id=confreg_conferencesession.id)",
}
)

)

for session in sessions:
if not session.has_slides:
for speaker in session.speaker.all():
send_conference_mail(
conference,
speaker.email,
"Your Slides".format(conference),
"confreg/mail/speaker_remind_slides.txt",
{
"conference": conference,
"session": session,
},
receivername=speaker.fullname,
)

speaker.lastmodified = timezone.now()
speaker.save()
whatstr.write(
"Reminded speaker {0} to submit slides for session {1}".format(speaker.name, session.title))
session.lastnotifiedtime = timezone.now()
session.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.18 on 2023-03-03 13:17

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('confreg', '0095_tweet_conf_time_idx'),
]

operations = [
migrations.AddField(
model_name='conference',
name='slide_upload_reminder_days',
field=models.IntegerField(default=0, help_text='Days to wait before sending speakers reminder to upload their slides', validators=[django.core.validators.MinValueValidator(0)]),
),
]
9 changes: 9 additions & 0 deletions postgresqleu/confreg/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ class Conference(models.Model):
twitter_timewindow_end = models.TimeField(null=False, blank=False, default='23:59:59', verbose_name="Don't post tweets after")
twitter_postpolicy = models.IntegerField(null=False, blank=False, default=0, choices=TWITTER_POST_CHOICES,
verbose_name="Posting policy")
slide_upload_reminder_days = models.IntegerField(
blank=False,
null=False,
default=0,
validators=[
MinValueValidator(0),
],
help_text="Days to wait before sending speakers reminder to upload their slides",
)

administrators = models.ManyToManyField(User, blank=True)
testers = models.ManyToManyField(User, blank=True, related_name="testers_set", help_text="Users who can bypass the '<function> is open' check and access pages before they're open, in order to test")
Expand Down
16 changes: 16 additions & 0 deletions template.jinja/confreg/mail/speaker_remind_slides.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Hello!

We hope you're doing well.

We wanted to remind you that we are still waiting for you to upload the slides
used for your session titled "{{session.title}}" at the {{conference}}.

We totally get it - life can get pretty hectic sometimes. But hey, we are sure
attendees would love to have access to the killer content you shared at {{conference}}.


If you intend to upload your slides , please try to do it as soon as possible so that
attendees can access them promptly.


If you have any issues or questions regarding the upload process, please do not hesitate to contact us.