mirror of
https://codeberg.org/pluja/kycnot.me
synced 2025-08-12 00:11:21 -04:00
improve score summary style
This commit is contained in:
parent
c970e21c72
commit
3ff66f4676
1 changed files with 6 additions and 2 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
func ComputeScore(s *database.Service) (int, string) {
|
func ComputeScore(s *database.Service) (int, string) {
|
||||||
summary := fmt.Sprintf("SCORE BREAKDOWN - %s:\n", s.Name)
|
summary := fmt.Sprintf("SCORE BREAKDOWN - %s:\n", s.Name)
|
||||||
|
summary += "\n||-----------------------------------------------"
|
||||||
|
|
||||||
grade := float64(10)
|
grade := float64(10)
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ func ComputeScore(s *database.Service) (int, string) {
|
||||||
|
|
||||||
if !isP2P && grade > 9.5 {
|
if !isP2P && grade > 9.5 {
|
||||||
grade = 9
|
grade = 9
|
||||||
summary += fmt.Sprintf("\n%-*s--> Not P2P, score can't be 10.", 10, "|| +0.5")
|
summary += fmt.Sprintf("\n%-*s--> Not P2P, score can't be 10.", 10, "|| ----")
|
||||||
}
|
}
|
||||||
|
|
||||||
if isP2P {
|
if isP2P {
|
||||||
|
@ -121,9 +122,12 @@ func ComputeScore(s *database.Service) (int, string) {
|
||||||
// Normalize the grade to be within 0-10 bounds
|
// Normalize the grade to be within 0-10 bounds
|
||||||
grade = math.Min(10, math.Max(0, grade))
|
grade = math.Min(10, math.Max(0, grade))
|
||||||
|
|
||||||
summary += "\n||---------------------------------------"
|
summary += "\n||-----------------------------------------------"
|
||||||
|
|
||||||
summary += fmt.Sprintf("\n|| %-*v--> Total (rounded to even)", 6, math.RoundToEven(grade)) // Call ComputeScore to get the actual score
|
summary += fmt.Sprintf("\n|| %-*v--> Total (rounded to even)", 6, math.RoundToEven(grade)) // Call ComputeScore to get the actual score
|
||||||
|
summary += "\n||-----------------------------------------------"
|
||||||
|
|
||||||
|
summary += "\n\n\nCheck out the score algorithm here: https://github.com/pluja/kycnot.me\nIf you think there's a better way to compute score, please, open an issue with your ideas."
|
||||||
|
|
||||||
return int(math.RoundToEven(grade)), summary
|
return int(math.RoundToEven(grade)), summary
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue