Skip to content

Commit 88dd33c

Browse files
committed
Stars adjustment fixed.
1 parent 73abc68 commit 88dd33c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

codeorigins/fetchers/api.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,29 @@ def _adjust_min_stars(self, language_name):
167167
def get_totals(totals, stars):
168168
nonlocal increasing, decreasing
169169

170-
if stars <= STARS_MIN:
171-
return totals, stars
172-
173170
for total_repos, _ in self.client.iter_repos(language_name, stars):
174171
totals = total_repos
175172
break
176173

177174
if totals > REPOS_BASE and not decreasing:
178175
LOG.debug(' Too many repos `%s`. Adding stars ...', totals)
179176
increasing = True
180-
totals, stars = get_totals(totals, stars+stars_step)
177+
stars_next = stars + stars_step
178+
179+
if stars_next <= STARS_MIN:
180+
return totals, STARS_MIN
181+
182+
totals, stars = get_totals(totals, stars_next)
181183

182184
elif totals < REPOS_BASE and not increasing:
183185
LOG.debug(' Too few repos `%s`. Removing stars ...', totals)
184186
decreasing = True
185-
totals, stars = get_totals(totals, stars-stars_step)
187+
stars_next = stars - stars_step
188+
189+
if stars_next <= STARS_MIN:
190+
return totals, STARS_MIN
191+
192+
totals, stars = get_totals(totals, stars_next)
186193

187194
return totals, stars
188195

0 commit comments

Comments
 (0)