Skip to content

Commit

Permalink
Update update_leaderboard.py
Browse files Browse the repository at this point in the history
Updated Ranking Algorithm
  • Loading branch information
KimFarida authored Oct 31, 2023
1 parent aa1951a commit 9f6a83b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions update_leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def leaderboard_data():
sorted_users, avi = get_sorted_pr()
leaderboard_data = []
pos = 1
prev_count = None # Variable to keep track of the previous user's PR count

# Dictionary to store medals
medals = {
Expand All @@ -90,6 +91,10 @@ def leaderboard_data():
}

for user, count in sorted_users:
# Check if the current user has the same number of PRs as the previous user
if prev_count is not None and count < prev_count:
pos += 1

# Assign medals based on position
medal = medals.get(pos, str(pos))
leaderboard_data.append({
Expand All @@ -99,12 +104,14 @@ def leaderboard_data():
"contributor": f"[{user}](https://github.com/{user})",
"merged_prs": f"{count}"
})
pos += 1


# Update previous count for comparison in the next iteration
prev_count = count

return leaderboard_data



leaderboard_data = leaderboard_data()


Expand Down

0 comments on commit 9f6a83b

Please sign in to comment.