Added formatting precision for anime ratings

This commit is contained in:
Eduard Urbach 2017-10-20 17:24:16 +02:00
parent c3b6a021d6
commit 8ec7adb770
3 changed files with 14 additions and 6 deletions

View File

@ -1,2 +1,2 @@
component Rating(value float64)
.anime-rating= int(value + 0.5)
component Rating(value float64, user *arn.User)
.anime-rating= fmt.Sprintf("%." + strconv.Itoa(user.Settings().Format.RatingsPrecision) + "f", value)

View File

@ -51,16 +51,16 @@ component Anime(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]*
.anime-rating-category-name Hype
else
.anime-rating-category-name Overall
Rating(anime.Rating.Overall)
Rating(anime.Rating.Overall, user)
.anime-rating-category(title=toString(anime.Rating.Story))
.anime-rating-category-name Story
Rating(anime.Rating.Story)
Rating(anime.Rating.Story, user)
.anime-rating-category(title=toString(anime.Rating.Visuals))
.anime-rating-category-name Visuals
Rating(anime.Rating.Visuals)
Rating(anime.Rating.Visuals, user)
.anime-rating-category(title=toString(anime.Rating.Soundtrack))
.anime-rating-category-name Soundtrack
Rating(anime.Rating.Soundtrack)
Rating(anime.Rating.Soundtrack, user)
if len(friends) > 0
h3.anime-section-name Friends

View File

@ -158,6 +158,14 @@ component Settings(user *arn.User)
Icon("star")
span Go PRO
.widget.mountable(data-api="/api/settings/" + user.ID)
h3.widget-title
Icon("font")
span Formatting
.widget-section
InputNumber("Format.RatingsPrecision", float64(user.Settings().Format.RatingsPrecision), "Ratings precision", "How many decimals after the comma would you like to display in ratings?", "0", "2", "1")
//- .widget.mountable(data-api="/api/settings/" + user.ID)
//- h3.widget-title
//- Icon("cogs")