Skip to content

Commit

Permalink
fix: Replace filters with methods
Browse files Browse the repository at this point in the history
Also fix has_notes() to be consistent with has_recordings()
  • Loading branch information
richsalz committed Mar 22, 2024
1 parent 65d8394 commit 466a630
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 27 deletions.
16 changes: 0 additions & 16 deletions ietf/doc/templatetags/ietf_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,19 +881,3 @@ def badgeify(blob):
)

return text

@register.filter
def has_chat_logs(meeting):
num = meeting.get_number()
return num != None and num >= 60

@register.filter
def has_recordings(meeting):
if meeting.type_id != 'ietf':
return True
num = meeting.get_number()
return num != None and num >= 80

#register.filter
#define has_notes(meeting):
return meeting.uses_notes()
15 changes: 14 additions & 1 deletion ietf/meeting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,20 @@ def previous_meeting(self):
return Meeting.objects.filter(type_id=self.type_id,date__lt=self.date).order_by('-date').first()

def uses_notes(self):
return self.date>=datetime.date(2020,7,6)
if meeting.type_id != 'ietf':
return True
num = meeting.get_number()
return num != None and num >= 108

def has_recordings(meeting):
if meeting.type_id != 'ietf':
return True
num = meeting.get_number()
return num != None and num >= 80

def has_chat_logs(meeting):
num = meeting.get_number()
return num != None and num >= 60

def meeting_start(self):
"""Meeting-local midnight at the start of the meeting date"""
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/meeting/interim_session_buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</a>
{% endif %}
{# notes #}
{% if meeting|has_notes %}
{% if meeting.uses_notes() %}
<a class="btn btn-outline-primary"
href="{{ session.notes_url }}"
aria-label="Notepad for note-takers"
Expand Down
12 changes: 6 additions & 6 deletions ietf/templates/meeting/session_buttons_include.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</a>
{% endif %}
{# Notes #}
{% if meeting|has_notes %}
{% if meeting.uses_notes() %}
<a class="btn btn-outline-primary"
role="button"
href="{{ session.notes_url }}"
Expand Down Expand Up @@ -126,7 +126,7 @@
</a>
{% else %}
{# chat logs #}
{% if meeting|has_chat_logs %}
{% if meeting.has_chat_logs() %}
<a class="btn btn-outline-primary"
role="button"
href="{{session.chat_archive_url}}"
Expand All @@ -136,7 +136,7 @@
</a>
{% endif %}
{# Recordings #}
{% if meeting|has_recordings %}
{% if meeting.has_recordings() %}
{% with session.recordings as recordings %}
{% if recordings %}
{# There's no guaranteed order, so this is a bit messy: #}
Expand Down Expand Up @@ -229,7 +229,7 @@
</li>
{% endif %}
{# Notes #}
{% if meeting|has_notes %}
{% if meeting.uses_notes() %}
<li>
<a class="dropdown-item" href="{{ session.notes_url }}">
<i class="bi bi-journal-text"></i> Notepad for note-takers
Expand Down Expand Up @@ -303,7 +303,7 @@
</li>
{% else %}
{# chat logs #}
{% if meeting|has_chat_logs %}
{% if meeting.has_chat_logs() %}
<li>
<a class="dropdown-item"
href="session.chat_room_url">
Expand All @@ -312,7 +312,7 @@
</li>
{% endif %}
{# Recordings #}
{% if meeting|has_recordings %}
{% if meeting.has_recordings() %}
{% with session.recordings as recordings %}
{% if recordings %}
{# There's no guaranteed order, so this is a bit messy: #}
Expand Down
6 changes: 3 additions & 3 deletions ietf/templates/meeting/session_details_panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ <h3 class="mt-4">Meeting tools</h3>
<table class="table table-sm table-striped meeting-tools"
id="meeting_tools_{{ session.pk }}">
<tbody>
{% if meeting|has_notes %}
{% if meeting.uses_notes() %}
<tr>
<td>
<a href="{{ session.notes_url }}">
Expand Down Expand Up @@ -310,7 +310,7 @@ <h3 class="mt-4">Notes and recordings</h3>
<table class="table table-sm table-striped meeting-tools"
id="notes_and_recordings_{{ session.pk }}">
<tbody>
{% if meeting|has_notes %}
{% if meeting.uses_notes() %}
<tr>
<td>
<a href="{{ session.notes_url }}">
Expand All @@ -320,7 +320,7 @@ <h3 class="mt-4">Notes and recordings</h3>
</tr>
{% endif %}
{# Recordings #}
{% if meeting|has_recordings %}
{% if meeting.has_recordings() %}
{% with session.recordings as recordings %}
{% if recordings %}
{# There's no guaranteed order, so this is a bit messy: #}
Expand Down

0 comments on commit 466a630

Please sign in to comment.