From 29f570b1e2af1ede52dcc9e4d707af871d83347f Mon Sep 17 00:00:00 2001 From: Shawn Smith Date: Sat, 6 Feb 2016 17:23:39 +0900 Subject: [PATCH] change high score amount to 50 --- handlers/check.go | 10 +++++----- tools/mongotobolt.go | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/handlers/check.go b/handlers/check.go index a67879d..84d4efd 100644 --- a/handlers/check.go +++ b/handlers/check.go @@ -132,9 +132,9 @@ func updateHighScores(mb *bolt.Bucket, resp checksResp, repo string) error { json.Unmarshal(scoreBytes, scores) heap.Init(scores) - if len(*scores) > 0 && (*scores)[0].Score > resp.Average*100.0 && len(*scores) == 100 { + if len(*scores) > 0 && (*scores)[0].Score > resp.Average*100.0 && len(*scores) == 50 { // lowest score on list is higher than this repo's score, so no need to add, unless - // we do not have 100 high scores yet + // we do not have 50 high scores yet return nil } // if this repo is already in the list, remove the original entry: @@ -150,9 +150,9 @@ func updateHighScores(mb *bolt.Bucket, resp checksResp, repo string) error { Score: resp.Average * 100.0, Files: resp.Files, }) - if len(*scores) > 100 { - // trim heap if it's grown to over 100 - *scores = (*scores)[:100] + if len(*scores) > 50 { + // trim heap if it's grown to over 50 + *scores = (*scores)[1:51] } scoreBytes, err := json.Marshal(&scores) if err != nil { diff --git a/tools/mongotobolt.go b/tools/mongotobolt.go index 84bb543..4c47ef9 100644 --- a/tools/mongotobolt.go +++ b/tools/mongotobolt.go @@ -145,9 +145,9 @@ func updateHighScores(mb *bolt.Bucket, resp checksResp, repo string) error { json.Unmarshal(scoreBytes, scores) heap.Init(scores) - if len(*scores) > 0 && (*scores)[0].Score > resp.Average*100.0 && len(*scores) == 100 { + if len(*scores) > 0 && (*scores)[0].Score > resp.Average*100.0 && len(*scores) == 50 { // lowest score on list is higher than this repo's score, so no need to add, unless - // we do not have 100 high scores yet + // we do not have 50 high scores yet return nil } // if this repo is already in the list, remove the original entry: @@ -163,9 +163,9 @@ func updateHighScores(mb *bolt.Bucket, resp checksResp, repo string) error { Score: resp.Average * 100.0, Files: resp.Files, }) - if len(*scores) > 100 { - // trim heap if it's grown to over 100 - *scores = (*scores)[:100] + if len(*scores) > 50 { + // trim heap if it's grown to over 50 + *scores = (*scores)[1:51] } scoreBytes, err := json.Marshal(&scores) if err != nil {