Skip to content

Commit 4c6aa09

Browse files
committed
Added date information to the 'scheduled session' emails, and also a link to an ical file for the group sessions. Fixes issue ietf-tools#2461.
- Legacy-Id: 14722
1 parent 578960c commit 4c6aa09

2 files changed

Lines changed: 21 additions & 24 deletions

File tree

ietf/secr/meetings/views.py

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,6 @@ def send_notifications(meeting, groups, person):
181181
Send session scheduled email notifications for each group in groups. Person is the
182182
user who initiated this action, request.uesr.get_profile().
183183
'''
184-
session_info_template = '''{0} Session {1} ({2})
185-
{3}, {4} {5}
186-
Room Name: {6}
187-
---------------------------------------------
188-
'''
189184
now = datetime.datetime.now()
190185
for group in groups:
191186
sessions = group.session_set.filter(meeting=meeting)
@@ -198,27 +193,24 @@ def send_notifications(meeting, groups, person):
198193
template = 'meetings/session_schedule_notification.txt'
199194

200195
# easier to populate template from timeslot perspective. assuming one-to-one timeslot-session
201-
count = 0
202-
session_info = ''
203-
data = [ (s,get_timeslot(s)) for s in sessions ]
204-
data = [ (s,t) for s,t in data if t ]
205-
data.sort(key=lambda d: d[1].time)
206-
for s,t in data:
207-
count += 1
208-
session_info += session_info_template.format(group.acronym,
209-
count,
210-
s.requested_duration,
211-
t.time.strftime('%A'),
212-
t.name,
213-
'%s-%s' % (t.time.strftime('%H%M'),(t.time + t.duration).strftime('%H%M')),
214-
t.location)
196+
items = [ {'session':s, 'timeslot':get_timeslot(s)} for s in sessions ]
197+
items.sort(key=lambda d: d['timeslot'].time)
198+
for i,d in enumerate(items):
199+
s = d['session']
200+
t = d['timeslot']
201+
dur = s.requested_duration.seconds/60
202+
items[i]['duration'] = "%d:%02d" % (dur//60, dur%60)
203+
items[i]['period'] = '%s-%s' % (t.time.strftime('%H%M'),(t.time + t.duration).strftime('%H%M'))
215204

216205
# send email
217-
context = {}
206+
context = {
207+
'items': items,
208+
'meeting': meeting,
209+
'baseurl': settings.IDTRACKER_BASE_URL,
210+
}
218211
context['to_name'] = sessions[0].requested_by
219212
context['agenda_note'] = sessions[0].agenda_note
220213
context['session'] = get_initial_session(sessions)
221-
context['session_info'] = session_info
222214
context['group'] = group
223215
context['login'] = sessions[0].requested_by
224216

ietf/secr/templates/meetings/session_schedule_notification.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ The session(s) that you have requested have been scheduled.
44
Below is the scheduled session information followed by
55
the original request.
66

7-
{{ session_info }}
7+
{% for item in items %}
8+
{{ group.acronym }} Session {{ forloop.counter }} ({{ item.duration }} requested)
9+
{{item.timeslot.time|date:"l, j F Y"}}, {{ item.timeslot.name }} {{ item.period }}
10+
Room Name: {{item.timeslot.location}}
11+
---------------------------------------------{% endfor %}
812
{% if agenda_note %}
9-
Special Note: {{ agenda_note }}
10-
{% endif %}
13+
Special Note: {{ agenda_note }}{% endif %}
14+
15+
iCalendar: {{ baseurl }}{% url "ietf.meeting.views.ical_agenda" num=meeting.number acronym=group.acronym %}
1116

1217
Request Information:
1318

0 commit comments

Comments
 (0)