Skip to content

Commit b78eb44

Browse files
committed
chore: remove some unused code
1 parent 195926a commit b78eb44

1 file changed

Lines changed: 65 additions & 57 deletions

File tree

ietf/meeting/models.py

Lines changed: 65 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from django.urls import reverse as urlreverse
2727
from django.utils import timezone
2828
from django.utils.text import slugify
29-
from django.utils.safestring import mark_safe
3029

3130
from ietf.dbtemplate.models import DBTemplate
3231
from ietf.doc.models import Document
@@ -582,19 +581,23 @@ def session(self):
582581
self._session_cache = self.sessions.filter(timeslotassignments__schedule__in=[self.meeting.schedule, self.meeting.schedule.base if self.meeting else None]).first()
583582
return self._session_cache
584583

585-
def meeting_date(self):
586-
return self.time.date()
584+
# Unused
585+
#
586+
# def meeting_date(self):
587+
# return self.time.date()
587588

588-
def registration(self):
589-
# below implements a object local cache
590-
# it tries to find a timeslot of type registration which starts at the same time as this slot
591-
# so that it can be shown at the top of the agenda.
592-
if not hasattr(self, '_reg_info'):
593-
try:
594-
self._reg_info = TimeSlot.objects.get(meeting=self.meeting, time__month=self.time.month, time__day=self.time.day, type="reg")
595-
except TimeSlot.DoesNotExist:
596-
self._reg_info = None
597-
return self._reg_info
589+
# Unused
590+
#
591+
# def registration(self):
592+
# # below implements a object local cache
593+
# # it tries to find a timeslot of type registration which starts at the same time as this slot
594+
# # so that it can be shown at the top of the agenda.
595+
# if not hasattr(self, '_reg_info'):
596+
# try:
597+
# self._reg_info = TimeSlot.objects.get(meeting=self.meeting, time__month=self.time.month, time__day=self.time.day, type="reg")
598+
# except TimeSlot.DoesNotExist:
599+
# self._reg_info = None
600+
# return self._reg_info
598601

599602
def __str__(self):
600603
location = self.get_location()
@@ -621,30 +624,33 @@ def get_hidden_location(self):
621624
def get_location(self):
622625
return self.get_hidden_location() if self.show_location else ""
623626

624-
def get_functional_location(self):
625-
name_parts = []
626-
room = self.location
627-
if room and room.functional_name:
628-
name_parts.append(room.functional_name)
629-
location = self.get_hidden_location()
630-
if location:
631-
name_parts.append(location)
632-
return ' - '.join(name_parts)
633-
634-
def get_html_location(self):
635-
if not hasattr(self, '_cached_html_location'):
636-
self._cached_html_location = self.get_location()
637-
if len(self._cached_html_location) > 8:
638-
self._cached_html_location = mark_safe(self._cached_html_location.replace('/', '/<wbr>'))
639-
else:
640-
self._cached_html_location = mark_safe(self._cached_html_location.replace(' ', '&nbsp;'))
641-
return self._cached_html_location
627+
# Unused
628+
#
629+
# def get_functional_location(self):
630+
# name_parts = []
631+
# room = self.location
632+
# if room and room.functional_name:
633+
# name_parts.append(room.functional_name)
634+
# location = self.get_hidden_location()
635+
# if location:
636+
# name_parts.append(location)
637+
# return ' - '.join(name_parts)
638+
639+
# def get_html_location(self):
640+
# if not hasattr(self, '_cached_html_location'):
641+
# self._cached_html_location = self.get_location()
642+
# if len(self._cached_html_location) > 8:
643+
# self._cached_html_location = mark_safe(self._cached_html_location.replace('/', '/<wbr>'))
644+
# else:
645+
# self._cached_html_location = mark_safe(self._cached_html_location.replace(' ', '&nbsp;'))
646+
# return self._cached_html_location
642647

643648
def tz(self):
644649
return self.meeting.tz()
645650

646-
def tzname(self):
647-
return self.tz().tzname(self.time)
651+
# Unused
652+
# def tzname(self):
653+
# return self.tz().tzname(self.time)
648654

649655
def utc_start_time(self):
650656
return self.time.astimezone(pytz.utc) # USE_TZ is True, so time is aware
@@ -658,30 +664,32 @@ def local_start_time(self):
658664
def local_end_time(self):
659665
return (self.time.astimezone(pytz.utc) + self.duration).astimezone(self.tz())
660666

661-
@property
662-
def js_identifier(self):
663-
# this returns a unique identifier that is js happy.
664-
# {{s.timeslot.time|date:'Y-m-d'}}_{{ s.timeslot.time|date:'Hi' }}"
665-
# also must match:
666-
# {{r|slugify}}_{{day}}_{{slot.0|date:'Hi'}}
667-
dom_id="ts%u" % (self.pk)
668-
if self.location is not None:
669-
dom_id = self.location.dom_id()
670-
return "%s_%s_%s" % (dom_id, self.time.strftime('%Y-%m-%d'), self.time.strftime('%H%M'))
671-
672-
def delete_concurrent_timeslots(self):
673-
"""Delete all timeslots which are in the same time as this slot"""
674-
# can not include duration in filter, because there is no support
675-
# for having it a WHERE clause.
676-
# below will delete self as well.
677-
for ts in self.meeting.timeslot_set.filter(time=self.time).all():
678-
if ts.duration!=self.duration:
679-
continue
680-
681-
# now remove any schedule that might have been made to this
682-
# timeslot.
683-
ts.sessionassignments.all().delete()
684-
ts.delete()
667+
# Unused
668+
#
669+
# @property
670+
# def js_identifier(self):
671+
# # this returns a unique identifier that is js happy.
672+
# # {{s.timeslot.time|date:'Y-m-d'}}_{{ s.timeslot.time|date:'Hi' }}"
673+
# # also must match:
674+
# # {{r|slugify}}_{{day}}_{{slot.0|date:'Hi'}}
675+
# dom_id="ts%u" % (self.pk)
676+
# if self.location is not None:
677+
# dom_id = self.location.dom_id()
678+
# return "%s_%s_%s" % (dom_id, self.time.strftime('%Y-%m-%d'), self.time.strftime('%H%M'))
679+
680+
# def delete_concurrent_timeslots(self):
681+
# """Delete all timeslots which are in the same time as this slot"""
682+
# # can not include duration in filter, because there is no support
683+
# # for having it a WHERE clause.
684+
# # below will delete self as well.
685+
# for ts in self.meeting.timeslot_set.filter(time=self.time).all():
686+
# if ts.duration!=self.duration:
687+
# continue
688+
689+
# # now remove any schedule that might have been made to this
690+
# # timeslot.
691+
# ts.sessionassignments.all().delete()
692+
# ts.delete()
685693

686694
"""
687695
Find a timeslot that comes next, in the same room. It must be on the same day,

0 commit comments

Comments
 (0)