Permalink
Browse files

made pleblist history page a bit more crash-resistant

  • Loading branch information...
1 parent 60340f4 commit 92b1acc06e77003aa591f518391153835d7f9d55 @pajlada committed Dec 23, 2016
Showing with 6 additions and 0 deletions.
  1. +2 −0 pajbot/web/routes/base/pleblist.py
  2. +4 −0 templates/pleblist_history.html
@@ -48,6 +48,8 @@ def pleblist_history_stream(stream_id):
q = session.query(PleblistSong, User).outerjoin(User, PleblistSong.user_id == User.id).filter(PleblistSong.stream_id == stream.id).order_by(PleblistSong.id.asc(), PleblistSong.id.asc())
songs = []
for song, user in q:
+ if song.song_info is None:
+ continue
song.user = user
songs.append(song)
@@ -50,7 +50,11 @@ <h2 class="pemote">Pleblist History - {{ stream.title }}</h2>
<br />
{% if song.date_played is not none %}
{% if song.skip_after is none %}
+ {% if song.song_info is none %}
+ {% set song_duration = 5 %}
+ {% else %}
{% set song_duration = song.song_info.duration %}
+ {% endif %}
{% elif song.skip_after is not none %}
{% set song_duration = song.skip_after %}
{% else %}

0 comments on commit 92b1acc

Please sign in to comment.