From 39cd616c903b2fc0651e3258b26ba03ac4394d9d Mon Sep 17 00:00:00 2001
From: Philip Sargent <philip.sargent@klebos.com>
Date: Fri, 7 May 2021 23:46:11 +0100
Subject: [PATCH] survexstations also tabulated

---
 core/views/statistics.py |  6 ++++--
 templates/eastings.html  | 11 +++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/core/views/statistics.py b/core/views/statistics.py
index 99af707..8f2cc47 100644
--- a/core/views/statistics.py
+++ b/core/views/statistics.py
@@ -13,7 +13,7 @@ from django.utils import timezone
 
 from troggle.core.models.troggle import Expedition, Person, PersonExpedition, DataIssue
 from troggle.core.models.caves import Cave, LogbookEntry, Entrance
-from troggle.core.models.survex import SurvexBlock
+from troggle.core.models.survex import SurvexBlock, SurvexStation
 
 import troggle.settings as settings
 
@@ -167,4 +167,6 @@ def eastings(request):
         if e.easting or e.northing:
             ents.append(e)
  
-    return render(request,'eastings.html',  {'ents': ents})
+    stations = SurvexStation.objects.all()
+ 
+    return render(request,'eastings.html',  {'ents': ents, 'stations': stations})
diff --git a/templates/eastings.html b/templates/eastings.html
index 40e72b6..422c9ea 100644
--- a/templates/eastings.html
+++ b/templates/eastings.html
@@ -25,5 +25,16 @@ These are all the locations specified in Northing/Easting coordinates in the sys
 {% endfor %}
 </table>
 
+<p>But the Entrances - the objects in the troggle system - are not properly connected to the dataset which is the combined set of survex data. They are only linked - and only implicitly - by the tag name.
+<table cellpadding="6" cellspacing="8">
+<tr><th>Survex Station</th><th>x</th><th>y</th></tr>
+{% for s in stations %}
+<tr>
+  <td style="text-align:left; width:240px"> {{s.name|safe}} </td>
+  <td style="text-align:right; width:90px"> {{s.x|floatformat:2}} </td>
+  <td style="text-align:right; width:90px"> {{s.y|floatformat:2}} </td>
+</tr>
+{% endfor %}
+</table>
 
 {% endblock %}
\ No newline at end of file