Skip to content

Commit 8ef0c35

Browse files
committed
Show all sundays until today instead of latest commit
1 parent 2c567ea commit 8ef0c35

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

models/contributors/contributors_graph.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ func GetContributorStats(ctx context.Context, repo *repo_model.Repository) (map[
5656
return nil, fmt.Errorf("ExtendedCommitStats: %w", err)
5757
}
5858

59+
layout := "2006-01-02"
5960
initial_commit_date := extended_commit_stats[0].Author.Date
60-
last_commit_date := extended_commit_stats[len(extended_commit_stats)-1].Author.Date
61+
6162

6263
starting_sunday, _ := util.FindLastSundayBeforeDate(initial_commit_date)
63-
ending_sunday, _ := util.FindFirstSundayAfterDate(last_commit_date)
64+
ending_sunday, _ := util.FindFirstSundayAfterDate(time.Now().Format(layout))
6465

6566
sundays, _ := util.ListSundaysBetween(starting_sunday, ending_sunday)
6667

@@ -99,7 +100,6 @@ func GetContributorStats(ctx context.Context, repo *repo_model.Repository) (map[
99100
user, _ := contributors_commit_stats[v.Author.Email]
100101
starting_of_week, _ := util.FindLastSundayBeforeDate(v.Author.Date)
101102

102-
layout := "2006-01-02"
103103
val, _ := time.Parse(layout, starting_of_week)
104104
starting_sunday_p, _ := time.Parse(layout, starting_sunday)
105105
idx := int(val.Sub(starting_sunday_p).Hours()/24)/7

0 commit comments

Comments
 (0)