Skip to content
This repository has been archived by the owner on Oct 12, 2020. It is now read-only.

Commit

Permalink
Fix bugs with low amount of stargazers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ullaakut committed Jul 14, 2019
1 parent b12eba9 commit 74a2d53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/gql/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func getCursors(ctx *context.Context, sg []stargazers, totalUsers uint) []string
}
}

if totalUsers <= 200 {
if totalUsers <= 219 {
disgo.Infof("All %d stargazers will be scanned\n", totalUsers)
return cursors
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/trust/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func Compute(ctx *context.Context, users []gql.User) (*Report, error) {

defer disgo.EndStep()

if uint(len(users)) >= 200 {
if uint(len(users)) > 219 {
return buildComparativeReport(trustData)
}

Expand All @@ -80,8 +80,7 @@ func Compute(ctx *context.Context, users []gql.User) (*Report, error) {

func buildReport(trustData map[FactorName][]float64) (*Report, error) {
report := &Report{
Factors: make(map[FactorName]Factor),
Percentiles: make(map[Percentile]Factor),
Factors: make(map[FactorName]Factor),
}

for factor, data := range trustData {
Expand All @@ -100,6 +99,7 @@ func buildReport(trustData map[FactorName][]float64) (*Report, error) {
// Only compute percentiles if there are enough stargazers to be
// able to compute every fifth percentile.
if len(trustData[ContributionScoreFactor]) > 20 {
report.Percentiles = make(map[Percentile]Factor)
for _, percentile := range percentiles {
// Error is ignored on purpose.
pctl, _ := strconv.ParseFloat(string(percentile), 64)
Expand Down

0 comments on commit 74a2d53

Please sign in to comment.