Fix missing timestamp on first chapter

This commit is contained in:
syeopite 2023-08-21 01:16:33 -07:00
parent 3fba6f5728
commit 08d82cc749
No known key found for this signature in database
GPG Key ID: A73C186DA3955A1A
1 changed files with 8 additions and 3 deletions

View File

@ -3,8 +3,9 @@
<hr class="description-content-separator"/>
<h4>Chapters</h4>
<div class="description-chapters-content-container">
<% chapters.each do | chapter |%>
<a href="/watch?v=<%= video.id %>&t=<%=chapter.start_ms.milliseconds.total_seconds.to_i %>">
<% chapters.each do | chapter | %>
<%- start_in_seconds = chapter.start_ms.milliseconds.total_seconds.to_i %>
<a href="/watch?v=<%-= video.id %>&t=<%=start_in_seconds %>">
<div class="chapter">
<div class="thumbnail">
<%- if !env.get("preferences").as(Preferences).thin_mode -%>
@ -13,7 +14,11 @@
<div class="thumbnail-placeholder"></div>
<%- end -%>
</div>
<p><%-= recode_length_seconds(chapter.start_ms.milliseconds.total_seconds) -%></p>
<%- if start_in_seconds > 0 -%>
<p><%-= recode_length_seconds(start_in_seconds) -%></p>
<%- else -%>
<p>0:00</p>
<%- end -%>
<p><%-=chapter.title-%></p>
</div>
</a>