Skip to content

Commit

Permalink
Merge pull request #62 from jasonlong/fix-longest-streak
Browse files Browse the repository at this point in the history
Fix longest streak logic
  • Loading branch information
jasonlong authored Oct 7, 2016
2 parents 9eb9ed6 + e1a7ebb commit aa8a568
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 42 deletions.
15 changes: 5 additions & 10 deletions chrome/iso.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Isometric Contributions",
"version": "1.0.12",
"version": "1.0.13",
"description": "Renders an isometric pixel view of GitHub contribution graphs.",
"content_scripts": [ {
"css": [ "iso.css" ],
Expand Down
Binary file modified firefox/isometric-contributions.xpi
Binary file not shown.
15 changes: 5 additions & 10 deletions firefox/isometric-contributions/iso.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion firefox/isometric-contributions/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Isometric Contributions",
"version": "1.0.12",
"version": "1.0.13",
"description": "Renders an isometric pixel view of GitHub contribution graphs.",
"content_scripts": [ {
"css": [ "iso.css" ],
Expand Down
4 changes: 2 additions & 2 deletions safari/isometric-contributions.safariextension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0.12</string>
<string>1.0.13</string>
<key>CFBundleVersion</key>
<string>1.0.12</string>
<string>1.0.13</string>
<key>Chrome</key>
<dict>
<key>Database Quota</key>
Expand Down
15 changes: 5 additions & 10 deletions safari/isometric-contributions.safariextension/iso.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions src/iso.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Iso
if graphContainer
observer = new MutationObserver (mutations) =>
isGraphAdded = mutations.find (mutation) ->
[].find.call mutation.addedNodes, (node) ->
[].find.call mutation.addedNodes, (node) ->
node.className == "js-contribution-graph"
if isGraphAdded
this.generateIsometricChart()
Expand Down Expand Up @@ -129,7 +129,6 @@ class Iso
streakCurrent = 0
tempStreak = 0
tempStreakStart = null
tempStreakEnd = null
longestStreakStart = null
longestStreakEnd = null
currentStreakStart = null
Expand All @@ -155,19 +154,15 @@ class Iso
if currentDayCount > 0
if tempStreak == 0
tempStreakStart = ($ this).data('date')
tempStreakEnd = ($ this).data('date')

tempStreak++

if tempStreak >= streakLongest
tempStreakEnd = ($ this).data('date')

else
if tempStreak >= streakLongest
longestStreakStart = tempStreakStart
longestStreakEnd = tempStreakEnd
longestStreakEnd = ($ this).data('date')
streakLongest = tempStreak

else
tempStreak = 0
tempStreakStart = null
tempStreakEnd = null
Expand Down

0 comments on commit aa8a568

Please sign in to comment.