Skip to content

Commit 989ee1e

Browse files
committed
Improve definition of has_custom_time
has_custom_time is True iff the session has a custom start or end, the course has a default start or end, and either of those does not match.
1 parent a84f701 commit 989ee1e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

naucse/models.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,16 @@ def _session_time(self, key):
362362

363363
@reify
364364
def has_custom_time(self):
365-
return self._session_time('start') is not None
365+
session_start_time = self._session_time('start')
366+
session_end_time = self._session_time('end')
367+
368+
custom_start = session_start_time is not None \
369+
and self.course.default_start_time is not None \
370+
and session_start_time != self.course.default_start_time
371+
custom_end = session_end_time is not None \
372+
and self.course.default_end_time is not None \
373+
and session_end_time != self.course.default_end_time
374+
return custom_start or custom_end
366375

367376
@reify
368377
def start_time(self):

0 commit comments

Comments
 (0)