Skip to content

Commit

Permalink
Adding sorting by age metric
Browse files Browse the repository at this point in the history
  • Loading branch information
fedir committed Apr 14, 2018
1 parent 986f130 commit 02f6c56
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions competition.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ func rateGhData(ghData []Repository) string {
ghData[i].PlacementOverall = ghData[i].PlacementOverall + i
}

// Add points by age (newest is better)
sort.Slice(ghData[:], func(i, j int) bool {
return ghData[i].Age < ghData[j].Age
})
greetings += fmt.Sprintf("* The newest project is `%s`\n", ghData[0].Name)
for i := range ghData {
ghData[i].PlacementAge = i + 1
Expand Down

0 comments on commit 02f6c56

Please sign in to comment.