Skip to content

Commit

Permalink
feat: Allow agenda_note to be edited from the schedule editor (#5115)
Browse files Browse the repository at this point in the history
* feat: Add agenda_note to the SessionDetailsForm

* fix: Add hidden agenda_note field to session_details_form.html

* fix: Stop using agenda_note to filter sessions in import_audio_files()

* chore: Migrate sessions with agenda_note='CANCELED' to canceled state
  • Loading branch information
jennifer-richards authored Feb 9, 2023
1 parent 6bbad15 commit 1fc2042
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 8 deletions.
3 changes: 2 additions & 1 deletion ietf/meeting/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,8 @@ class Meta:
model = Session
fields = (
'purpose', 'name', 'short', 'type', 'requested_duration',
'on_agenda', 'remote_instructions', 'attendees', 'comments',
'on_agenda', 'agenda_note', 'remote_instructions', 'attendees',
'comments',
)
labels = {'requested_duration': 'Length'}

Expand Down
49 changes: 49 additions & 0 deletions ietf/meeting/migrations/0060_normalize_canceled_sessions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Generated by Django 2.2.28 on 2023-02-08 22:41

from django.db import migrations
from django.db.models import Subquery, OuterRef, Value, TextField
from django.db.models.functions import Coalesce


def forward(apps, schema_editor):
Session = apps.get_model('meeting', 'Session')
SchedulingEvent = apps.get_model('meeting', 'SchedulingEvent')
Person = apps.get_model('person', 'Person')

# annotation borrowed from SessionQuerySet.with_current_status()
sessions = Session.objects.annotate(
# coalesce with '' to avoid nulls which give funny
# results, e.g. .exclude(current_status='canceled') also
# skips rows with null in them
current_status=Coalesce(
Subquery(
SchedulingEvent.objects.filter(
session=OuterRef('pk')
).order_by(
'-time', '-id'
).values('status')[:1]),
Value(''),
output_field=TextField()),
).exclude(
current_status__in=['canceled', 'canceledpa'],
)
system_person = Person.objects.get(name='(System)')

# Cancel any uncanceled sessions marked as 'CANCELED' in the agenda_note
for session in sessions.filter(agenda_note='CANCELED'):
SchedulingEvent.objects.create(session=session, status_id='canceled', by=system_person)


def reverse(apps, schema_editor):
pass # nothing to be done


class Migration(migrations.Migration):

dependencies = [
('meeting', '0059_rename_sessions'),
]

operations = [
migrations.RunPython(forward, reverse),
]
8 changes: 2 additions & 6 deletions ietf/secr/proceedings/proc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,16 @@ def import_audio_files(meeting):
Example: ietf90-salonb-20140721-1710.mp3
'''
from ietf.meeting.utils import add_event_info_to_session_qs

unmatched_files = []
path = os.path.join(settings.MEETING_RECORDINGS_DIR, meeting.type.slug + meeting.number)
if not os.path.exists(path):
return None
for filename in os.listdir(path):
timeslot = get_timeslot_for_filename(filename)
if timeslot:
sessions = add_event_info_to_session_qs(Session.objects.filter(
sessions = Session.objects.with_current_status().filter(
timeslotassignments__schedule=timeslot.meeting.schedule_id,
).exclude(
agenda_note__icontains='canceled'
)).filter(
).filter(
current_status='sched',
).order_by('timeslotassignments__timeslot__time')
if not sessions:
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/meeting/session_details_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
</table>
{% endif %}
{# hidden fields included whether or not the whole form is hidden #}
{{ form.attendees.as_hidden }}{{ form.comments.as_hidden }}{{ form.id.as_hidden }}{{ form.on_agenda.as_hidden }}{{ form.DELETE.as_hidden }}{{ form.remote_instructions.as_hidden }}{{ form.short.as_hidden }}
{{ form.attendees.as_hidden }}{{ form.comments.as_hidden }}{{ form.id.as_hidden }}{{ form.on_agenda.as_hidden }}{{ form.DELETE.as_hidden }}{{ form.remote_instructions.as_hidden }}{{ form.short.as_hidden }}{{ form.agenda_note.as_hidden }}
</div>

0 comments on commit 1fc2042

Please sign in to comment.