1
0

Simplified a for loop for last songs list.

This commit is contained in:
Alexander Andreev 2024-06-19 01:03:51 +04:00
parent 9b959eb7ab
commit 293e1a3126
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -97,18 +97,16 @@ templ Index(curSong *radio.Song, sl []radio.Song, slLen int64, lstnrs *radio.Lis
</tr>
</thead>
<tbody>
if sl != nil && len(sl) != 0 {
for i := 0; i < len(sl); i++ {
<tr>
<td>{ utils.ToClientTimezone(sl[i].StartAt, r).Format("15:04") }</td>
if sl[i].PeakListeners != 0 {
<td>{ strconv.FormatInt(sl[i].Listeners, 10) }/{ strconv.FormatInt(sl[i].PeakListeners, 10) }</td>
for _, song := range sl {
<tr>
<td>{ utils.ToClientTimezone(song.StartAt, r).Format("15:04") }</td>
if song.PeakListeners != 0 {
<td>{ strconv.FormatInt(song.Listeners, 10) }/{ strconv.FormatInt(song.PeakListeners, 10) }</td>
} else {
<td></td>
}
<td>{ sl[i].Artist } - { sl[i].Title }</td>
</tr>
}
<td>{ song.Artist } - { song.Title }</td>
</tr>
}
</tbody>
</table>