@@ -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
0 commit comments