Skip to content

Commit

Permalink
idk there isn't a compiler to tell me if I fucked up
Browse files Browse the repository at this point in the history
LATE NIGHT MOBILE COMMITS
  • Loading branch information
mbaraa authored Jun 9, 2024
1 parent 1bd54a1 commit dc4db5b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions app/services/history/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,15 @@ func (h *Service) Get(profileId, page uint) ([]entities.Song, error) {
songs = append(songs, song)
}

songsFreqs := make(map[string]int)
songsFreqs := make(map[entities.Song]int)
for _, song := range songs {
songsFreqs[song.YtId]++
songsFreqs[song]++
}
songsFr := make([]entities.Song, 0)
for i := 0; i < len(songs); i++ {
s := songs[i]
s.AddedAt = fmt.Sprintf("Played %s - %s", times(songsFreqs[songs[i].YtId]), songs[i].AddedAt)
for s, f := range songsFreqs {
s.AddedAt = fmt.Sprintf("Played %s - %s", times(f), s.AddedAt)
songsFr = append(songsFr, s)
if songsFreqs[songs[i].YtId] > 1 {
i += songsFreqs[songs[i].YtId]
}
}
}

return songsFr, nil
}
Expand Down

0 comments on commit dc4db5b

Please sign in to comment.