Added airing dates
This commit is contained in:
@ -2,7 +2,6 @@ package animelist
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
@ -26,9 +25,7 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusNotFound, "Anime list not found", nil)
|
||||
}
|
||||
|
||||
sort.Slice(animeList.Items, func(i, j int) bool {
|
||||
return animeList.Items[i].FinalRating() > animeList.Items[j].FinalRating()
|
||||
})
|
||||
animeList.Sort()
|
||||
|
||||
return ctx.HTML(components.AnimeList(animeList, user))
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ component AnimeList(animeList *arn.AnimeList, user *arn.User)
|
||||
thead
|
||||
tr
|
||||
th.anime-list-item-name Anime
|
||||
th.anime-list-item-airing-date Airing
|
||||
th.anime-list-item-episodes Episodes
|
||||
th.anime-list-item-rating Rating
|
||||
if user != nil
|
||||
@ -12,6 +13,9 @@ component AnimeList(animeList *arn.AnimeList, user *arn.User)
|
||||
tr.anime-list-item.mountable(title=item.Notes)
|
||||
td.anime-list-item-name
|
||||
a.ajax(href=item.Link(animeList.User().Nick))= item.Anime().Title.Canonical
|
||||
td.anime-list-item-airing-date
|
||||
if item.Anime().UpcomingEpisode() != nil
|
||||
span.utc-date(data-start-date=item.Anime().UpcomingEpisode().Episode.AiringDate.Start, data-end-date=item.Anime().UpcomingEpisode().Episode.AiringDate.End, data-episode-number=item.Anime().UpcomingEpisode().Episode.Number)
|
||||
td.anime-list-item-episodes
|
||||
.anime-list-item-episodes-watched= item.Episodes
|
||||
.anime-list-item-episodes-separator /
|
||||
|
@ -51,6 +51,13 @@
|
||||
.raw-icon
|
||||
margin-bottom -4px
|
||||
|
||||
.anime-list-item-airing-date
|
||||
display none
|
||||
|
||||
> 700px
|
||||
.anime-list-item-airing-date
|
||||
display block
|
||||
|
||||
< 1100px
|
||||
.anime-list-item-rating
|
||||
display none
|
@ -2,7 +2,6 @@ package dashboard
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/aerogo/flow"
|
||||
@ -68,22 +67,19 @@ func dashboard(ctx *aero.Context) string {
|
||||
}
|
||||
|
||||
allAnimeInList := objects.([]*arn.Anime)
|
||||
now := time.Now().UTC().Format(time.RFC3339)
|
||||
|
||||
for _, anime := range allAnimeInList {
|
||||
if len(upcomingEpisodes) >= maxScheduleItems {
|
||||
break
|
||||
}
|
||||
|
||||
for _, episode := range anime.Episodes {
|
||||
if episode.AiringDate.Start > now {
|
||||
upcomingEpisodes = append(upcomingEpisodes, &arn.UpcomingEpisode{
|
||||
Anime: anime,
|
||||
Episode: episode,
|
||||
})
|
||||
continue
|
||||
}
|
||||
futureEpisodes := anime.UpcomingEpisodes()
|
||||
|
||||
if len(futureEpisodes) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
upcomingEpisodes = append(upcomingEpisodes, futureEpisodes...)
|
||||
}
|
||||
|
||||
sort.Slice(upcomingEpisodes, func(i, j int) bool {
|
||||
|
@ -2,7 +2,6 @@ package embed
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
@ -23,9 +22,7 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusNotFound, "Anime list not found", nil)
|
||||
}
|
||||
|
||||
sort.Slice(animeList.Items, func(i, j int) bool {
|
||||
return animeList.Items[i].FinalRating() > animeList.Items[j].FinalRating()
|
||||
})
|
||||
animeList.Sort()
|
||||
|
||||
return utils.AllowEmbed(ctx, ctx.HTML(components.AnimeList(animeList, user)))
|
||||
}
|
||||
|
Reference in New Issue
Block a user