| 12345678910111213141516171819202122232425 |
- package views
- import "fmt"
- // SongCount holds the played/total song counts for a jam.
- type SongCount struct {
- Played int
- Total int
- }
- // dateOnly extracts the YYYY-MM-DD prefix from a PocketBase datetime string.
- func dateOnly(s string) string {
- if len(s) >= 10 {
- return s[:10]
- }
- return s
- }
- // songCountDisplay formats a played/total pair as "X / Y", or "" when total is 0.
- func songCountDisplay(sc SongCount) string {
- if sc.Total == 0 {
- return ""
- }
- return fmt.Sprintf("%d / %d", sc.Played, sc.Total)
- }
|