mirror of
https://codeberg.org/pluja/kycnot.me
synced 2024-10-01 01:05:59 -04:00
improve score summary style
This commit is contained in:
parent
c970e21c72
commit
3ff66f4676
@ -9,6 +9,7 @@ import (
|
||||
|
||||
func ComputeScore(s *database.Service) (int, string) {
|
||||
summary := fmt.Sprintf("SCORE BREAKDOWN - %s:\n", s.Name)
|
||||
summary += "\n||-----------------------------------------------"
|
||||
|
||||
grade := float64(10)
|
||||
|
||||
@ -105,7 +106,7 @@ func ComputeScore(s *database.Service) (int, string) {
|
||||
|
||||
if !isP2P && grade > 9.5 {
|
||||
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 {
|
||||
@ -121,9 +122,12 @@ func ComputeScore(s *database.Service) (int, string) {
|
||||
// Normalize the grade to be within 0-10 bounds
|
||||
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 += "\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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user