Skip to content
Merged
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
4 changes: 2 additions & 2 deletions twisted/twisted_site/hackatime.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, UTC
import requests
from dataclasses import dataclass

Expand Down Expand Up @@ -48,7 +48,7 @@ def me(access_token) -> MeResponse:
def projects(
access_token,
include_archived=False,
start: datetime | None = None,
start: datetime | None = datetime(2026, 9, 7, tzinfo=UTC),
projects: list[str] | None = None,
) -> list[HackatimeProject]:
"""Returns the user's projects with time totals."""
Expand Down
60 changes: 60 additions & 0 deletions twisted/twisted_site/templates/admin/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ <h3 class="text-lg font-semibold mb-1">
<c-ui.badge size="sm" color="{{ user.profile.ysws_eligible|yesno:'green,red' }}"
>{{ user.profile.ysws_eligible|yesno:"YSWS eligible,Not YSWS eligible" }}</c-ui.badge
>
{% if user.profile.referred_by %}
<c-ui.badge size="sm" color="blue" href="{% url 'admin.users.detail' id=user.profile.referred_by.user.id %}"
>Referred by @{{ user.profile.referred_by.slack_username }}</c-ui.badge
>
{% endif %}
</div>
{% endif %}
</div>
Expand Down Expand Up @@ -61,6 +66,61 @@ <h1 class="text-lg font-bold">
</c-ui.card>
{% endif %}
</div>
<div class="mt-4">
<h1 class="text-2xl font-black">Referrals</h1>
{% if user.profile.referrals.all %}
<c-ui.card class="bg-ink-900 p-0">
<c-ui.table>
<thead>
<tr>
<th>Referral</th>
<th>Time logged</th>
<th>Progress</th>
<th>YSWS eligible</th>
</tr>
</thead>
<tbody>
{% for referral in user.profile.referrals.all %}
<tr>
<td>
<a href="{% url 'admin.users.detail' id=referral.user.id %}" class="flex items-center gap-2">
<c-ui.avatar size="sm" src="{{ referral.slack_pfp_url }}" />
@{{ referral.slack_username }}
</a>
</td>
<td>{{ referral.time_logged|minutes_to_hours_minutes }} / 1h</td>
<td class="min-w-32">
<c-ui.progress
value="{% if referral.time_logged > 60 %}100{% else %}{% widthratio referral.time_logged 60 100 %}{% endif %}"
color="{% if referral.time_logged >= 60 %}green{% else %}accent{% endif %}"
show_value="True"
/>
</td>
<td>
<div class="size-8">
{% if referral.ysws_eligible %}
<img src="https://icons.hackclub.com/api/icons/green/checkmark" alt="YSWS eligible" class="size-fill">
{% else %}
<img src="https://icons.hackclub.com/api/icons/red/view-close" alt="Not YSWS eligible" class="size-fill">
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</c-ui.table>
</c-ui.card>
{% else %}
<c-ui.card class="bg-ink-900">
<h1 class="text-lg font-bold">
No referrals found :(
</h1>
<p>
This user hasn't referred anyone yet!
</p>
</c-ui.card>
{% endif %}
</div>
{% if login_maybe %}
<div class="mt-4">
<form method="post" onsubmit="return confirm('Toggle this user\'s allowed state?');">
Expand Down
2 changes: 1 addition & 1 deletion twisted/twisted_site/views/admin/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get(self, request):
Q(additional_context={})
)

paginator = Paginator(auditlogs, 250, orphans=50)
paginator = Paginator(auditlogs, 100, orphans=50)
context['logs'] = paginator.get_page(page_number)
context['log_count'] = auditlogs.count()
return TemplateResponse(request, "admin/logs.html", context=context)