Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions website/management/commands/fetch_discord_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ def handle(self, *args, **options):
"description": server.get("description", ""),
"member_count": server.get("approximate_member_count", 0),
"id": server_id,
"logo_url": f"https://cdn.discordapp.com/icons/{server_id}/{server.get('icon')}.png"
if server.get("icon")
else "",
"logo_url": (
f"https://cdn.discordapp.com/icons/{server_id}/{server.get('icon')}.png"
if server.get("icon")
else ""
),
"tags": server.get("keywords", []),
}

Expand Down
22 changes: 12 additions & 10 deletions website/management/commands/update_github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,18 @@ def handle(self, *args, **options):
"updated_at": timezone.make_aware(
datetime.strptime(pr["updated_at"], "%Y-%m-%dT%H:%M:%SZ")
),
"closed_at": timezone.make_aware(
datetime.strptime(pr["closed_at"], "%Y-%m-%dT%H:%M:%SZ")
)
if pr.get("closed_at")
else None,
"merged_at": timezone.make_aware(
datetime.strptime(pr["pull_request"]["merged_at"], "%Y-%m-%dT%H:%M:%SZ")
)
if merged
else None,
"closed_at": (
timezone.make_aware(datetime.strptime(pr["closed_at"], "%Y-%m-%dT%H:%M:%SZ"))
if pr.get("closed_at")
else None
),
"merged_at": (
timezone.make_aware(
datetime.strptime(pr["pull_request"]["merged_at"], "%Y-%m-%dT%H:%M:%SZ")
)
if merged
else None
),
"is_merged": merged,
"url": pr["html_url"],
"user_profile": user,
Expand Down
24 changes: 15 additions & 9 deletions website/management/commands/update_repos_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,11 @@ def save_issues_and_prs(self, repo, dollar_issues, closed_prs):
"type": "issue",
"created_at": timezone.make_aware(datetime.strptime(issue["created_at"], "%Y-%m-%dT%H:%M:%SZ")),
"updated_at": timezone.make_aware(datetime.strptime(issue["updated_at"], "%Y-%m-%dT%H:%M:%SZ")),
"closed_at": timezone.make_aware(datetime.strptime(issue["closed_at"], "%Y-%m-%dT%H:%M:%SZ"))
if issue.get("closed_at")
else None,
"closed_at": (
timezone.make_aware(datetime.strptime(issue["closed_at"], "%Y-%m-%dT%H:%M:%SZ"))
if issue.get("closed_at")
else None
),
"url": issue["html_url"],
"has_dollar_tag": True,
},
Expand All @@ -402,12 +404,16 @@ def save_issues_and_prs(self, repo, dollar_issues, closed_prs):
"type": "pull_request",
"created_at": timezone.make_aware(datetime.strptime(pr["created_at"], "%Y-%m-%dT%H:%M:%SZ")),
"updated_at": timezone.make_aware(datetime.strptime(pr["updated_at"], "%Y-%m-%dT%H:%M:%SZ")),
"closed_at": timezone.make_aware(datetime.strptime(pr["closed_at"], "%Y-%m-%dT%H:%M:%SZ"))
if pr.get("closed_at")
else None,
"merged_at": timezone.make_aware(datetime.strptime(pr["merged_at"], "%Y-%m-%dT%H:%M:%SZ"))
if pr.get("merged_at")
else None,
"closed_at": (
timezone.make_aware(datetime.strptime(pr["closed_at"], "%Y-%m-%dT%H:%M:%SZ"))
if pr.get("closed_at")
else None
),
"merged_at": (
timezone.make_aware(datetime.strptime(pr["merged_at"], "%Y-%m-%dT%H:%M:%SZ"))
if pr.get("merged_at")
else None
),
"is_merged": bool(pr.get("merged_at")),
"url": pr["html_url"],
},
Expand Down
98 changes: 57 additions & 41 deletions website/templates/leaderboard_global.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ <h1 class="page-header">Global Leaderboard</h1>
</div>
<div class="flex flex-col md:gap-10 px-4 gap-2 md:px-0">
<div class="flex justify-center gap-6 flex-wrap">
<div class=" flex-1 border-2 border-gray-300 pb-3 rounded-b-lg flex-1 min-w-[300px] max-w-[550px]">
<div class="text-center text-3xl font-bold py-4 border-2 border-red-500 rounded-t-lg">Points Leaderboard</div>
<div class=" flex-1 border-2 border-[#e74c3c] pb-3 rounded-lg flex-1 min-w-[300px] max-w-[550px]">
<div class="text-center text-3xl font-bold py-4 border-b-2 border-[#e74c3c] rounded-t-lg">Points Leaderboard</div>
<div class=" list-group w-full p-4">
{% if not leaderboard %}
<p class="text-red-500 text-center font-medium">No data for this month!</p>
<p class="text-[#e74c3c] text-center font-medium">No data for this month!</p>
{% else %}
<div class="flex flex-col gap-2">
{% for leader in leaderboard %}
Expand Down Expand Up @@ -77,98 +77,114 @@ <h1 class="page-header">Global Leaderboard</h1>
{% endif %}
</div>
</div>
<div class=" flex-1 border-2 border-gray-300 pb-3 rounded-b-lg flex-1 min-w-[300px] max-w-[550px]">
<div class=" text-center text-3xl font-bold py-4 border-2 border-red-500 rounded-t-lg">Pull Request Leaderboard</div>
<div class=" flex-1 border-2 border-[#e74c3c] pb-3 rounded-lg flex-1 min-w-[300px] max-w-[550px]">
<div class=" text-center text-3xl font-bold py-4 border-b-2 border-[#e74c3c] rounded-t-lg">
Pull Request Leaderboard
</div>
<div class=" list-group w-full p-4">
{% if pr_leaderboard %}
<div class="flex flex-col gap-2">
{% for leader in pr_leaderboard %}
<div class="flex justify-between items-center">
<div class="flex gap-2 items-center truncate">
{% if leader.user_profile__github_url %}
<img src="https://github.com/{{ leader.user_profile__user__username }}.png"
{% if leader.github_username %}
<img src="https://github.com/{{ leader.github_username }}.png"
class=" size-11 select-none border border-gray-200 rounded-full"
alt="{{ leader.user_profile__user__username }}"
width="50px"
height="50px">
{% else %}
{% elif leader.user_profile__user__email %}
<img src="{% gravatar_url leader.user_profile__user__email 50 %}"
class=" size-11 select-none border border-gray-200 rounded-full"
alt="username"
width="50px"
height="50px">
{% else %}
<img src="{% gravatar_url 'default@example.com' 50 %}"
class=" size-11 select-none border border-gray-200 rounded-full"
alt="username"
width="50px"
height="50px">
{% endif %}
{% if leader.user_profile__user__username %}
<a href="{% url 'profile' slug=leader.user_profile__user__username %}"
class="text-lg transition-all duration-200">{{ leader.user_profile__user__username }}</a>
{% else %}
<span class="text-lg transition-all duration-200">{{ leader.user_profile__user__email|default:"Unknown User" }}</span>
<span class="text-lg text-gray-500">Unknown User</span>
{% endif %}
{% if leader.user_profile__github_url %}
<a href="{{ leader.user_profile__github_url }}"
target="_blank"
class="ml-2">
<i class="fab fa-github text-xl"></i>
</a>
{% endif %}
<a href="{{ leader.user_profile__github_url }}"
target="_blank"
class="ml-2">
<i class="fab fa-github text-xl"></i>
</a>
</div>
<span class="pull-right badge bg-gray-100 flex-shrink-0 rounded-md py-1 px-2 select-none">{{ leader.total_prs }} PRs</span>
</div>
<div class="border-t border-gray-200 my-1"></div>
{% endfor %}
</div>
{% else %}
<p class="text-red-500 text-center font-medium">No pull request data available!</p>
<p class="text-[#e74c3c] text-center font-medium">No pull request data available!</p>
{% endif %}
</div>
</div>
<div class=" flex-1 border-2 border-gray-300 pb-3 rounded-b-lg flex-1 min-w-[300px] max-w-[550px]">
<div class="text-center text-3xl font-bold py-4 border-2 border-red-500 rounded-t-lg">Code Review Leaderboard</div>
<div class=" flex-1 border-2 border-[#e74c3c] pb-3 rounded-lg flex-1 min-w-[300px] max-w-[550px]">
<div class="text-center text-3xl font-bold py-4 border-b-2 border-[#e74c3c] rounded-t-lg">Code Review Leaderboard</div>
<div class="list-group p-4">
{% if code_review_leaderboard %}
<div class="flex flex-col gap-2">
{% for leader in code_review_leaderboard %}
<div class="flex justify-between items-center">
<div class="flex gap-2 items-center truncate">
{% if leader.reviews__reviewer__user__username %}
<img src="https://github.com/{{ leader.reviews__reviewer__user__username }}.png"
{% if leader.github_username %}
<img src="https://github.com/{{ leader.github_username }}.png"
class=" size-11 select-none border border-gray-200 rounded-full"
alt="{{ leader.reviewer__user__username }}"
width="50px"
height="50px">
{% elif leader.reviewer__user__email %}
<img src="{% gravatar_url leader.reviewer__user__email 50 %}"
class=" size-11 select-none border border-gray-200 rounded-full"
alt="{{ leader.reviews__reviewer__user__username }}"
alt="username"
width="50px"
height="50px">
{% else %}
<img src="{% gravatar_url leader.reviews__reviewer__user__email 50 %}"
<img src="{% gravatar_url 'default@example.com' 50 %}"
class=" size-11 select-none border border-gray-200 rounded-full"
alt="username"
width="50px"
height="50px">
{% endif %}
{% if leader.reviews__reviewer__user__username %}
<a href="{% url 'profile' slug=leader.reviews__reviewer__user__username %}"
{% if leader.reviewer__user__username %}
<a href="{% url 'profile' slug=leader.reviewer__user__username %}"
class="text-lg transition-all duration-200">
{{ leader.reviews__reviewer__user__username }}
{{ leader.reviewer__user__username }}
</a>
{% if leader.reviewer__github_url %}
<a href="{{ leader.reviewer__github_url }}" target="_blank" class="ml-2">
<i class="fab fa-github text-xl"></i>
</a>
{% endif %}
{% else %}
<span class="text-lg transition-all duration-200">{{ leader.reviews__reviewer__user__email|default:"Unknown User" }}</span>
<span class="text-lg text-gray-500">Unknown User</span>
{% endif %}
<a href="https://github.com/{{ leader.reviews__reviewer__user__username }}"
target="_blank"
class="ml-2">
<i class="fab fa-github text-xl"></i>
</a>
</div>
<span class="pull-right badge bg-gray-100 flex-shrink-0 rounded-md py-1 px-2 select-none">Reviews: {{ leader.total_reviews }}</span>
</div>
<div class="border-t border-gray-200 my-1"></div>
{% endfor %}
</div>
{% else %}
<p class="text-red-500 text-center font-medium">No code review data available!</p>
<p class="text-[#e74c3c] text-center font-medium">No code review data available!</p>
{% endif %}
</div>
</div>
</div>
<div class="flex justify-center gap-6 flex-wrap">
<div class="flex-1 border-2 border-gray-300 pb-3 rounded-b-lg flex-1 min-w-[300px] max-w-[550px]">
<div class="text-center text-3xl font-bold py-4 border-2 border-red-500 rounded-t-lg">Top Visitors</div>
<div class="flex-1 border-2 border-[#e74c3c] pb-3 rounded-lg flex-1 min-w-[300px] max-w-[550px]">
<div class="text-center text-3xl font-bold py-4 border-b-2 border-[#e74c3c] rounded-t-lg">Top Visitors</div>
<div class="list-group w-full p-4">
{% if top_visitors %}
<div class="flex flex-col gap-2">
Expand All @@ -183,7 +199,7 @@ <h1 class="page-header">Global Leaderboard</h1>
height="50px">
{% else %}
<img src="{% gravatar_url profile.user.email 50 %}"
class="size-11 select-none border border-gray-200 rounded-full rounded-full"
class="size-11 select-none border border-gray-200 rounded-full"
alt="{{ profile.user.username }}"
width="50px"
height="50px">
Expand All @@ -200,24 +216,24 @@ <h1 class="page-header">Global Leaderboard</h1>
{% endfor %}
</div>
{% else %}
<p class="text-red-500 text-center font-medium">No visitor data available!</p>
<p class="text-[#e74c3c] text-center font-medium">No visitor data available!</p>
{% endif %}
</div>
</div>
<div class=" flex-1 border-2 border-gray-300 pb-3 rounded-b-lg flex-1 min-w-[300px] max-w-[550px]">
<div class="text-center text-3xl font-bold py-4 border-2 border-red-500 rounded-t-lg">Issue Bounties</div>
<div class=" flex-1 border-2 border-[#e74c3c] pb-3 rounded-lg flex-1 min-w-[300px] max-w-[550px]">
<div class="text-center text-3xl font-bold py-4 border-b-2 border-[#e74c3c] rounded-t-lg">Issue Bounties</div>
<div class=" list-group w-full p-4">
{% if not issue_bounties %}
<p class="text-red-500 text-center font-medium">No issue bounties data available!</p>
<p class="text-[#e74c3c] text-center font-medium">No issue bounties data available!</p>
{% else %}
{% endif %}
</div>
</div>
<div class=" flex-1 border-2 border-gray-300 pb-3 rounded-b-lg flex-1 min-w-[300px] max-w-[550px]">
<div class="text-center text-3xl font-bold py-4 border-2 border-red-500 rounded-t-lg">Bug Bounties</div>
<div class=" flex-1 border-2 border-[#e74c3c] pb-3 rounded-lg flex-1 min-w-[300px] max-w-[550px]">
<div class="text-center text-3xl font-bold py-4 border-b-2 border-[#e74c3c] rounded-t-lg">Bug Bounties</div>
<div class=" list-group w-full p-4">
{% if not bug_bounties %}
<p class="text-red-500 text-center font-medium">No bug bounties data available!</p>
<p class="text-[#e74c3c] text-center font-medium">No bug bounties data available!</p>
{% else %}
{% endif %}
</div>
Expand Down
Loading