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