Link to the timeslot editor when meeting has no timeslots. Fixes #3511. Commit ready for merge.
- Legacy-Id: 19841
This commit is contained in:
parent
6f3fb6930f
commit
64e904804d
|
@ -1677,6 +1677,23 @@ class EditMeetingScheduleTests(TestCase):
|
|||
self.assertEqual(r.status_code, 200)
|
||||
self.assertTrue(self._decode_json_response(r)['success'])
|
||||
|
||||
def test_editor_with_no_timeslots(self):
|
||||
"""Schedule editor should not crash when there are no timeslots"""
|
||||
meeting = MeetingFactory(
|
||||
type_id='ietf',
|
||||
date=datetime.date.today() + datetime.timedelta(days=7),
|
||||
populate_schedule=False,
|
||||
)
|
||||
meeting.schedule = ScheduleFactory(meeting=meeting)
|
||||
meeting.save()
|
||||
SessionFactory(meeting=meeting, add_to_schedule=False)
|
||||
self.assertEqual(meeting.timeslot_set.count(), 0, 'Test problem - meeting should not have any timeslots')
|
||||
url = urlreverse('ietf.meeting.views.edit_meeting_schedule', kwargs={'num': meeting.number})
|
||||
self.assertTrue(self.client.login(username='secretary', password='secretary+password'))
|
||||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertContains(r, 'No timeslots exist')
|
||||
self.assertContains(r, urlreverse('ietf.meeting.views.edit_timeslots', kwargs={'num': meeting.number}))
|
||||
|
||||
|
||||
class EditTimeslotsTests(TestCase):
|
||||
|
|
|
@ -506,8 +506,8 @@ def edit_meeting_schedule(request, num=None, owner=None, name=None):
|
|||
min_duration = min(t.duration for t in timeslots_qs)
|
||||
max_duration = max(t.duration for t in timeslots_qs)
|
||||
else:
|
||||
min_duration = 1
|
||||
max_duration = 2
|
||||
min_duration = datetime.timedelta(minutes=30)
|
||||
max_duration = datetime.timedelta(minutes=120)
|
||||
|
||||
def timedelta_to_css_ems(timedelta):
|
||||
# we scale the session and slots a bit according to their
|
||||
|
|
|
@ -75,8 +75,17 @@
|
|||
{% endif %}
|
||||
</p>
|
||||
|
||||
{% if timeslot_groups|length == 0 %}
|
||||
<p>
|
||||
No timeslots exist for this meeting yet.
|
||||
</p>
|
||||
<p>
|
||||
<a href="{% url "ietf.meeting.views.edit_timeslots" num=meeting.number %}">
|
||||
Edit timeslots.
|
||||
</a>
|
||||
</p>
|
||||
{% else %}
|
||||
<div class="edit-grid {% if not can_edit %}read-only{% endif %}">
|
||||
|
||||
{# using the same markup in both room labels and the actual days ensures they are aligned #}
|
||||
<div class="room-label-column">
|
||||
{% for day_data in days.values %}
|
||||
|
@ -165,6 +174,7 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="scheduling-panel">
|
||||
<div class="unassigned-container">
|
||||
|
|
Loading…
Reference in a new issue