Skip to content

Commit 9a82586

Browse files
committed
Fix issue where third session requests, which rerequire AD approval, get left with approved status, instead of scheduled, after Secretraiat sends out notifications of official schedule. Fixes ietf-tools#2765. Commit ready for merge.
- Legacy-Id: 16607
1 parent d332bfd commit 9a82586

2 files changed

Lines changed: 21 additions & 55 deletions

File tree

ietf/secr/meetings/tests.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from ietf.group.models import Group, GroupEvent
1919
from ietf.meeting.models import Meeting, Room, TimeSlot, SchedTimeSessAssignment, Session
2020
from ietf.meeting.test_data import make_meeting_test_data
21+
from ietf.name.models import SessionStatusName
2122
from ietf.person.models import Person
2223
from ietf.secr.meetings.forms import get_times
2324
from ietf.utils.mail import outbox
@@ -91,19 +92,7 @@ def test_add_meeting(self):
9192
self.assertEqual(response.status_code, 200)
9293
self.assertEqual(Meeting.objects.count(),count + 1)
9394
new_meeting = Meeting.objects.get(number=number)
94-
95-
# ensure new schedule is populated with specials sessions from previous meeting
9695
self.assertTrue(new_meeting.agenda)
97-
self.assertTrue(meeting.agenda.assignments.filter(timeslot__type='break').count() > 0)
98-
self.assertEqual(
99-
meeting.agenda.assignments.filter(timeslot__type='break').count(),
100-
new_meeting.agenda.assignments.filter(timeslot__type='break').count()
101-
)
102-
self.assertTrue(meeting.agenda.assignments.filter(timeslot__type='reg').count() > 0)
103-
self.assertEqual(
104-
meeting.agenda.assignments.filter(timeslot__type='reg').count(),
105-
new_meeting.agenda.assignments.filter(timeslot__type='reg').count()
106-
)
10796
self.assertEqual(new_meeting.attendees, None)
10897

10998
def test_edit_meeting(self):
@@ -159,16 +148,21 @@ def test_blue_sheets_generate(self):
159148
def test_notifications(self):
160149
"Test Notifications"
161150
meeting = make_meeting_test_data()
151+
mars_group = Group.objects.get(acronym='mars')
152+
ames_group = Group.objects.get(acronym='ames')
153+
ames_stsa = meeting.agenda.assignments.get(session__group=ames_group)
154+
assert ames_stsa.session.status_id == 'schedw'
155+
mars_stsa = meeting.agenda.assignments.get(session__group=mars_group)
156+
mars_stsa.session.status = SessionStatusName.objects.get(slug='appr')
157+
mars_stsa.session.save()
162158
url = reverse('ietf.secr.meetings.views.notifications',kwargs={'meeting_id':72})
163159
self.client.login(username="secretary", password="secretary+password")
164160
response = self.client.get(url)
165161
self.assertEqual(response.status_code, 200)
166162
q = PyQuery(response.content)
167163
self.assertEqual(q('#id_notification_list').html(),'ames, mars')
168-
164+
169165
# test that only changes since last notification show up
170-
mars_group = Group.objects.get(acronym='mars')
171-
ames_group = Group.objects.get(acronym='ames')
172166
now = datetime.datetime.now()
173167
then = datetime.datetime.now()+datetime.timedelta(hours=1)
174168
person = Person.objects.get(name="(System)")
@@ -183,13 +177,19 @@ def test_notifications(self):
183177
q = PyQuery(response.content)
184178
self.assertEqual(q('#id_notification_list').html(),'ames')
185179

186-
# test that email goes out
180+
# test post: email goes out, status changed
187181
mailbox_before = len(outbox)
188182
self.client.login(username="secretary", password="secretary+password")
189183
response = self.client.post(url)
190184
self.assertEqual(response.status_code, 302)
191185
self.assertEqual(len(outbox), mailbox_before + 1)
192-
186+
ames_stsa = meeting.agenda.assignments.get(session__group=ames_group)
187+
print(ames_stsa.session.status_id)
188+
assert ames_stsa.session.status_id == 'sched'
189+
mars_stsa = meeting.agenda.assignments.get(session__group=mars_group)
190+
print(mars_stsa.session.status_id)
191+
assert mars_stsa.session.status_id == 'sched'
192+
193193
def test_meetings_rooms(self):
194194
meeting = make_meeting_test_data()
195195
url = reverse('ietf.secr.meetings.views.rooms',kwargs={'meeting_id':72,'schedule_name':'test-agenda'})

ietf/secr/meetings/views.py

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright The IETF Trust 2007-2019, All Rights Reserved
2+
# -*- coding: utf-8 -*-
3+
14
import datetime
25
import os
36
import time
@@ -86,46 +89,12 @@ def build_timeslots(meeting,room=None):
8689
location=room,
8790
duration=t.duration)
8891

89-
def build_nonsession(meeting,schedule):
90-
'''
91-
This function takes a meeting object and creates non-session records
92-
for a new meeting, based on the last meeting
93-
'''
94-
last_meeting = get_last_meeting(meeting)
95-
if not last_meeting:
96-
return None
97-
98-
delta = meeting.date - last_meeting.date
99-
system = Person.objects.get(name='(System)')
100-
101-
for slot in TimeSlot.objects.filter(meeting=last_meeting,type__in=('break','reg','other','plenary','lead')):
102-
new_time = slot.time + delta
103-
session = Session.objects.create(meeting=meeting,
104-
name=slot.name,
105-
short=get_session(slot).short,
106-
group=get_session(slot).group,
107-
requested_by=system,
108-
status_id='sched',
109-
type=slot.type)
110-
111-
ts = TimeSlot.objects.create(type=slot.type,
112-
meeting=meeting,
113-
name=slot.name,
114-
time=new_time,
115-
duration=slot.duration,
116-
show_location=slot.show_location)
117-
SchedTimeSessAssignment.objects.create(schedule=schedule,session=session,timeslot=ts)
118-
11992
def check_nonsession(meeting,schedule):
12093
'''
12194
Ensure non-session timeslots exist and have appropriate SchedTimeSessAssignment objects
12295
for the specified schedule.
12396
'''
12497
slots = TimeSlot.objects.filter(meeting=meeting,type__in=('break','reg','other','plenary','lead','offagenda'))
125-
if not slots:
126-
build_nonsession(meeting,schedule)
127-
return None
128-
12998
plenary = slots.filter(type='plenary').first()
13099
if plenary:
131100
assignments = plenary.sessionassignments.all()
@@ -269,9 +238,6 @@ def add(request):
269238
meeting.save()
270239

271240
populate_important_dates(meeting)
272-
273-
# copy special sessions from previous meeting
274-
build_nonsession(meeting,schedule)
275241

276242
# Create Physical new meeting directory and subdirectories
277243
make_materials_directories(meeting)
@@ -605,7 +571,7 @@ def notifications(request, meeting_id):
605571
# ensure session state is scheduled
606572
for ss in meeting.agenda.assignments.all():
607573
session = ss.session
608-
if session.status.slug == "schedw":
574+
if session.status.slug in ["schedw", "appr"]:
609575
session.status_id = "sched"
610576
session.scheduled = datetime.datetime.now()
611577
session.save()

0 commit comments

Comments
 (0)