From 6844e771b581ddfc06fe0c66be11e7dcc779df5a Mon Sep 17 00:00:00 2001
From: moanos 
Date: Sat, 19 Oct 2024 19:46:11 +0200
Subject: [PATCH] feat: Add timestamps to instance health check
---
 .../instance-health-check.html                | 22 +++++++++++++++++++
 src/fellchensammlung/views.py                 |  8 +++++--
 2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html b/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html
index 6d64403..584f2c3 100644
--- a/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html
+++ b/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html
@@ -24,6 +24,28 @@
             {% translate "Texte scheinen vollständig" %}
         {% endif %}
 
+        {% trans "Zeitstempel" %}
+        {% if timestamps|length > 0 %}
+            
+            
+                
+                    | {% translate "Key" %} | 
+                    {% translate "Zeitstempel" %} | 
+                    {% translate "Daten" %} | 
+                
+                {% for timestamp in timestamps %}
+                    
+                        | {{ timestamp.key }} | 
+                        {{ timestamp.timestamp }} | 
+                        {{ timestamp.data }} | 
+                    
+                {% endfor %}
+            
+            
+        {% else %}
+            {% translate "Keine Zeitstempel geloggt." %}
+        {% endif %}
+
         {% translate "Nicht-lokalisierte Vermittlungen" %}
         {% if number_not_geocoded_adoption_notices > 0 %}
             
diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py
index 38d3c5a..3103e3e 100644
--- a/src/fellchensammlung/views.py
+++ b/src/fellchensammlung/views.py
@@ -14,7 +14,7 @@ from notfellchen import settings
 from fellchensammlung import logger
 from .models import AdoptionNotice, Text, Animal, Rule, Image, Report, ModerationAction, \
     User, Location, AdoptionNoticeStatus, Subscriptions, CommentNotification, BaseNotification, RescueOrganization, \
-    Species, Log
+    Species, Log, Timestamp
 from .forms import AdoptionNoticeForm, AdoptionNoticeFormWithDateWidget, ImageForm, ReportAdoptionNoticeForm, \
     CommentForm, ReportCommentForm, AnimalForm, \
     AdoptionNoticeSearchForm, AnimalFormWithDateWidget, AdoptionNoticeFormWithDateWidgetAutoAnimal
@@ -522,6 +522,9 @@ def instance_health_check(request):
             except Text.DoesNotExist:
                 missing_texts.append((text_code, language))
 
+    # Timestamps
+    timestamps = Timestamp.objects.all()
+
     context = {
         "number_of_adoption_notices": number_of_adoption_notices,
         "number_not_geocoded_adoption_notices": number_not_geocoded_adoption_notices,
@@ -531,7 +534,8 @@ def instance_health_check(request):
         "none_geocoded_rescue_orgs": none_geocoded_rescue_orgs,
         "missing_texts": missing_texts,
         "number_unchecked_ans": number_unchecked_ans,
-        "unchecked_ans": unchecked_ans
+        "unchecked_ans": unchecked_ans,
+        "timestamps": timestamps
     }
 
     return render(request, 'fellchensammlung/instance-health-check.html', context=context)