diff options
Diffstat (limited to 'internal/showcase/rank_history.go')
| -rw-r--r-- | internal/showcase/rank_history.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/internal/showcase/rank_history.go b/internal/showcase/rank_history.go index 7f62453..559237f 100644 --- a/internal/showcase/rank_history.go +++ b/internal/showcase/rank_history.go @@ -163,12 +163,12 @@ func movementArrow(currentSpot, olderSpot int) string { return "·" } if currentSpot == olderSpot { - return "=" + return "←" } if currentSpot < olderSpot { - return "↑" + return "↖" } - return "↓" + return "↙" } func formatRankHistoryForHeader(history []RepoRankHistory) string { @@ -177,24 +177,28 @@ func formatRankHistoryForHeader(history []RepoRankHistory) string { } tokens := make([]string, 0, len(history)) - for i, point := range history { + lastSpot := 0 + for _, point := range history { if point.Spot <= 0 { continue } - spot := fmt.Sprintf("#%d", point.Spot) - if i == 0 { + spot := fmt.Sprintf("%d", point.Spot) + if lastSpot == 0 { tokens = append(tokens, spot) + lastSpot = point.Spot continue } - tokens = append(tokens, point.Arrow+spot) + + tokens = append(tokens, movementArrow(lastSpot, point.Spot)+spot) + lastSpot = point.Spot } if len(tokens) == 0 { return "" } - return " · " + strings.Join(tokens, "") + return " " + strings.Join(tokens, "") } func anchorLabel(i int) string { |
