Make Owner optional; use dateparser to parse dates; use json-repair to read JSON

This commit is contained in:
Joakim Hellsén 2025-09-01 21:50:38 +02:00
commit 6d5f014134
12 changed files with 858 additions and 453 deletions

View file

@ -7,10 +7,13 @@
<h1>
<a href="{% url 'twitch:game_detail' campaign.game.id %}">{{ campaign.game.display_name }}</a> - {{ campaign.clean_name }}
</h1>
<p>
{# TODO: Link to organization #}
<a href="{% url 'twitch:organization_detail' campaign.owner.id %}">{{ campaign.owner.name }}</a>
</p>
{% if campaign.owner %}
<p>
<a href="{% url 'twitch:organization_detail' campaign.owner.id %}">{{ campaign.owner.name }}</a>
</p>
{% else %}
<p>Organization Unknown</p>
{% endif %}
{% if campaign.image_url %}
<img height="70"
width="70"

View file

@ -73,15 +73,19 @@
{% endif %}
</div>
<div style="flex: 1;">
{% comment %} Find this header section in your template {% endcomment %}
<header style="margin-bottom: 1rem;">
<h2 style="margin: 0 0 0.5rem 0;">
<a href="{% url 'twitch:game_detail' game_group.grouper.id %}"
style="text-decoration: none">{{ game_group.grouper.display_name|default:game_group.grouper.name|default:game_group.grouper.slug|default:game_group.grouper.id }}</a>
</h2>
<p style="margin: 0;">
<a href="{% url 'twitch:organization_detail' game_group.list.0.owner.id %}"
style="text-decoration: none">{{ game_group.list.0.owner.name }}</a>
</p>
{% comment %} MODIFICATION: Check if the owner exists before creating the link {% endcomment %}
{% if game_group.grouper.owner %}
<p style="margin: 0;">
<a href="{% url 'twitch:organization_detail' game_group.grouper.owner.id %}"
style="text-decoration: none">{{ game_group.grouper.owner.name }}</a>
</p>
{% endif %}
</header>
<div style="overflow-x: auto;">
<div style="display: flex; gap: 1rem; min-width: max-content;">

View file

@ -69,7 +69,7 @@ Hover over the end time to see the exact date and time.
Started {{ campaign.start_at|timesince }} ago
</time>
<time datetime="{{ campaign.created_at|date:'c' }}"
title="Scraped at {{ campaign.created_at|date:'DATETIME_FORMAT' }}"
title="{{ campaign.created_at|date:'DATETIME_FORMAT' }}"
style="font-size: 0.9rem;
color: #666;
display: block;
@ -77,7 +77,7 @@ Hover over the end time to see the exact date and time.
Scraped {{ campaign.created_at|timesince }} ago
</time>
<time datetime="{{ campaign.start_at|date:'c' }} to {{ campaign.end_at|date:'c' }}"
title="Duration: {{ campaign.start_at|date:'DATETIME_FORMAT' }} to {{ campaign.end_at|date:'DATETIME_FORMAT' }}"
title="{{ campaign.start_at|date:'DATETIME_FORMAT' }} to {{ campaign.end_at|date:'DATETIME_FORMAT' }}"
style="font-size: 0.9rem;
color: #666;
display: block;