Changed "Historische Version..." to "Zukünftige Version..." when appropriate
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 16s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
SonarQube Scan / SonarQube Trigger (push) Successful in 55s

This commit is contained in:
2025-12-08 15:34:14 +01:00
parent 0866e604bc
commit 0d7e63d3a2
5 changed files with 40 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ spec:
mountPath: /data
containers:
- name: web
image: git.baumann.gr/adebaumann/vui:0.972
image: git.baumann.gr/adebaumann/vui:0.973
imagePullPolicy: Always
ports:
- containerPort: 8000

View File

@@ -16,7 +16,11 @@
{% if standard.history == True %}
<div class="alert alert-warning" role="alert">
{% if standard.is_future %}
<strong>Zukünftige Version vom {{ standard.check_date }}</strong>
{% else %}
<strong>Historische Version vom {{ standard.check_date }}</strong>
{% endif %}
</div>
{% endif %}

View File

@@ -493,6 +493,38 @@ class ViewsTestCase(TestCase):
url = reverse('standard_history', kwargs={'nummer': 'R01234'})
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
def test_standard_history_past_date_shows_historische(self):
"""Test that past dates show 'Historische Version'"""
past_date = (date.today() - timedelta(days=30)).strftime('%Y-%m-%d')
url = f'/dokumente/R01234/history/{past_date}/'
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'Historische Version vom')
self.assertNotContains(response, 'Zukünftige Version vom')
# Verify is_future flag is False
self.assertFalse(response.context['standard'].is_future)
def test_standard_history_future_date_shows_zukuenftige(self):
"""Test that future dates show 'Zukünftige Version'"""
future_date = (date.today() + timedelta(days=30)).strftime('%Y-%m-%d')
url = f'/dokumente/R01234/history/{future_date}/'
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'Zukünftige Version vom')
self.assertNotContains(response, 'Historische Version vom')
# Verify is_future flag is True
self.assertTrue(response.context['standard'].is_future)
def test_standard_detail_current_has_no_version_label(self):
"""Test that current view (no history) has no version label"""
url = reverse('standard_detail', kwargs={'nummer': 'R01234'})
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertNotContains(response, 'Historische Version vom')
self.assertNotContains(response, 'Zukünftige Version vom')
# Verify history flag is False
self.assertFalse(response.context['standard'].history)
class URLPatternsTest(TestCase):

View File

@@ -29,9 +29,11 @@ def standard_detail(request, nummer,check_date=""):
if check_date:
check_date = calendar.parseDT(check_date)[0].date()
standard.history = True
standard.is_future = check_date > date.today()
else:
check_date = date.today()
standard.history = False
standard.is_future = False
standard.check_date=check_date
vorgaben = list(standard.vorgaben.order_by("thema","nummer").select_related("thema","dokument")) # convert queryset to list so we can attach attributes

View File

@@ -219,7 +219,7 @@
</p>
</div>
<div class="col-sm-6 text-right">
<p class="text-muted">Version {{ version|default:"0.972" }}</p>
<p class="text-muted">Version {{ version|default:"0.973" }}</p>
</div>
</div>
</div>