Brad Montgomery avatar Brad Montgomery committed 95dc44a

fixed a bug in the way we count thru paged changeset data for contributors

Comments (0)

Files changed (1)

+        api_hit_count = 0
         # Do this for every "page" of the changsets... 
         start = None
         remaining_changesets = 1
         retrieved_changesets = 0
         while remaining_changesets > 0:
             changesets = self.changesets(limit=limit, start=start)  # initial group of changesets
+            if start:
+                start = start + limit + 1
+            else:
+                start = limit + 1
+            api_hit_count += 1 # see how many times we've hit the api
             for cset in changesets.get('changesets', []):
                 _update_contributors(cset, contributors)
             retrieved_changesets += len(changesets.get('changesets', []))
-            start = retrieved_changesets + (changesets.get('start', None) or 0)
             remaining_changesets = changesets['count'] - retrieved_changesets
+            if remaining_changesets < start:
+                start = changesets['count'] - remaining_changesets
         #TODO sort based on contributions, like github does?
         for k,v in contributors.items():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.