diff --git a/src/utils/score.go b/src/utils/score.go index 0976103..b973618 100644 --- a/src/utils/score.go +++ b/src/utils/score.go @@ -8,6 +8,7 @@ import ( "pluja.dev/kycnot.me/database" "pluja.dev/kycnot.me/ent" + "pluja.dev/kycnot.me/ent/schema" ) func ComputeScore(s *ent.Service) int { @@ -41,6 +42,9 @@ func ComputeScore(s *ent.Service) int { } // Tos Highlights Penalty + if s.TosHighlights == nil { + s.TosHighlights = &[]schema.TosHighlight{} + } nTosH := len(*s.TosHighlights) nTosPenalty := float64(nTosH) * bonusMedium // Each 2 TOS highlights, decrease the score by 1 if nTosPenalty > maxTosPenalty {