Skip to content

Commit 795d861

Browse files
Hide timeslots type is disabled plus other schedule editor debugging/improvements. Fixes ietf-tools#3510. Fixes ietf-tools#3430. Commit ready for merge.
- Legacy-Id: 19878
1 parent c4bf508 commit 795d861

8 files changed

Lines changed: 355 additions & 148 deletions

File tree

ietf/meeting/forms.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -662,11 +662,15 @@ class SessionDetailsForm(forms.ModelForm):
662662

663663
def __init__(self, group, *args, **kwargs):
664664
session_purposes = group.features.session_purposes
665-
kwargs.setdefault('initial', {})
666-
kwargs['initial'].setdefault(
667-
'purpose',
668-
session_purposes[0] if len(session_purposes) > 0 else None,
669-
)
665+
# Default to the first allowed session_purposes. Do not do this if we have an instance,
666+
# though, because ModelForm will override instance data with initial data if it gets both.
667+
# When we have an instance we want to keep its value.
668+
if 'instance' not in kwargs:
669+
kwargs.setdefault('initial', {})
670+
kwargs['initial'].setdefault(
671+
'purpose',
672+
session_purposes[0] if len(session_purposes) > 0 else None,
673+
)
670674
super().__init__(*args, **kwargs)
671675

672676
self.fields['type'].widget.attrs.update({
@@ -678,11 +682,11 @@ def __init__(self, group, *args, **kwargs):
678682
self.fields['purpose'].queryset = SessionPurposeName.objects.filter(pk__in=session_purposes)
679683
if not group.features.acts_like_wg:
680684
self.fields['requested_duration'].durations = [datetime.timedelta(minutes=m) for m in range(30, 241, 30)]
681-
685+
682686
class Meta:
683687
model = Session
684688
fields = (
685-
'name', 'short', 'purpose', 'type', 'requested_duration',
689+
'purpose', 'name', 'short', 'type', 'requested_duration',
686690
'on_agenda', 'remote_instructions', 'attendees', 'comments',
687691
)
688692
labels = {'requested_duration': 'Length'}

ietf/meeting/tests_js.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,21 +541,21 @@ def test_past_swap_timeslot_col_buttons(self):
541541

542542
past_swap_ts_buttons = self.driver.find_elements(By.CSS_SELECTOR,
543543
','.join(
544-
'.swap-timeslot-col[data-start="{}"]'.format(ts.utc_start_time().isoformat()) for ts in past_timeslots
544+
'*[data-start="{}"] .swap-timeslot-col'.format(ts.utc_start_time().isoformat()) for ts in past_timeslots
545545
)
546546
)
547547
self.assertEqual(len(past_swap_ts_buttons), len(past_timeslots), 'Missing past swap timeslot col buttons')
548548

549549
future_swap_ts_buttons = self.driver.find_elements(By.CSS_SELECTOR,
550550
','.join(
551-
'.swap-timeslot-col[data-start="{}"]'.format(ts.utc_start_time().isoformat()) for ts in future_timeslots
551+
'*[data-start="{}"] .swap-timeslot-col'.format(ts.utc_start_time().isoformat()) for ts in future_timeslots
552552
)
553553
)
554554
self.assertEqual(len(future_swap_ts_buttons), len(future_timeslots), 'Missing future swap timeslot col buttons')
555555

556556
now_swap_ts_buttons = self.driver.find_elements(By.CSS_SELECTOR,
557557
','.join(
558-
'.swap-timeslot-col[data-start="{}"]'.format(ts.utc_start_time().isoformat()) for ts in now_timeslots
558+
'[data-start="{}"] .swap-timeslot-col'.format(ts.utc_start_time().isoformat()) for ts in now_timeslots
559559
)
560560
)
561561
self.assertEqual(len(now_swap_ts_buttons), len(now_timeslots), 'Missing "now" swap timeslot col buttons')

ietf/meeting/views.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -536,15 +536,17 @@ def prepare_sessions_for_display(sessions):
536536
for s in sessions:
537537
s.requested_by_person = requested_by_lookup.get(s.requested_by)
538538

539-
s.scheduling_label = "???"
540539
s.purpose_label = None
541-
if (s.purpose.slug in ('none', 'regular')) and s.group:
542-
s.scheduling_label = s.group.acronym
543-
s.purpose_label = 'BoF' if s.group.is_bof() else s.group.type.name
540+
if s.group:
541+
if (s.purpose.slug in ('none', 'regular')):
542+
s.scheduling_label = s.group.acronym
543+
s.purpose_label = 'BoF' if s.group.is_bof() else s.group.type.name
544+
else:
545+
s.scheduling_label = s.name if s.name else f'??? [{s.group.acronym}]'
546+
s.purpose_label = s.purpose.name
544547
else:
545-
s.purpose_label = s.purpose.name
546-
if s.name:
547-
s.scheduling_label = s.name
548+
s.scheduling_label = s.name if s.name else '???'
549+
s.purpose_label = s.purpose.name
548550

549551
s.requested_duration_in_hours = round(s.requested_duration.seconds / 60.0 / 60.0, 1)
550552

ietf/secr/meetings/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class MiscSessionForm(TimeSlotForm):
190190
Plenary = IETF''',
191191
required=False)
192192
location = forms.ModelChoiceField(queryset=Room.objects, required=False)
193-
remote_instructions = forms.CharField(max_length=255)
193+
remote_instructions = forms.CharField(max_length=255, required=False)
194194
show_location = forms.BooleanField(required=False)
195195

196196
def __init__(self,*args,**kwargs):

0 commit comments

Comments
 (0)