Browse Source

Move duration before published date

This is more consistent with word count being first.
merge-requests/55/head
Deimos 6 years ago
parent
commit
8fcc8e8b14
  1. 12
      tildes/tildes/models/topic/topic.py

12
tildes/tildes/models/topic/topic.py

@ -388,6 +388,12 @@ class Topic(DatabaseModel):
metadata_strings.append(f"{word_count} words") metadata_strings.append(f"{word_count} words")
if self.is_link_type: if self.is_link_type:
# display the duration if we have it
duration = self.get_content_metadata("duration")
if duration:
duration_delta = timedelta(seconds=duration)
metadata_strings.append(str(duration_delta).lstrip("0:"))
# display the published date if it's more than 3 days before the topic # display the published date if it's more than 3 days before the topic
published_timestamp = self.get_content_metadata("published") published_timestamp = self.get_content_metadata("published")
if published_timestamp: if published_timestamp:
@ -395,12 +401,6 @@ class Topic(DatabaseModel):
if self.created_time - published > timedelta(days=3): if self.created_time - published > timedelta(days=3):
metadata_strings.append(published.strftime("%b %-d %Y")) metadata_strings.append(published.strftime("%b %-d %Y"))
# display the duration if we have it
duration = self.get_content_metadata("duration")
if duration:
duration_delta = timedelta(seconds=duration)
metadata_strings.append(str(duration_delta).lstrip("0:"))
return ", ".join(metadata_strings) return ", ".join(metadata_strings)
@property @property

Loading…
Cancel
Save