mirror of
https://github.com/usetrmnl/plugins.git
synced 2026-04-29 13:32:45 -07:00
Update git commit graph current streak calculation
to no longer break the streak if the current day doesn't have any contributions (yet)
This commit is contained in:
@@ -77,7 +77,13 @@ module Plugins
|
||||
|
||||
def current_streak(days)
|
||||
streak = 0
|
||||
days.reverse_each do |day|
|
||||
|
||||
# The current day can count towards the streak but it shouldn't break the streak
|
||||
if (days.last()['contributionCount']).positive?
|
||||
streak += 1
|
||||
end
|
||||
|
||||
days[0..-2].reverse_each do |day|
|
||||
break if (day['contributionCount']).zero?
|
||||
|
||||
streak += 1
|
||||
|
||||
Reference in New Issue
Block a user