mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
Better standard entrances report
This commit is contained in:
parent
5d383e0445
commit
c51c2326fe
@ -265,13 +265,16 @@ class Entrance(TroggleModel):
|
||||
return str(self.slug)
|
||||
|
||||
def single(self, station):
|
||||
if not station:
|
||||
return None
|
||||
try:
|
||||
single = SurvexStation.objects.get(name = station)
|
||||
return single
|
||||
except:
|
||||
stations = SurvexStation.objects.filter(name = station)
|
||||
print(f" # MULTIPLE stations found with same name '{station}' in Entrance {self}:")
|
||||
print(f" # EXCEPTION looking for '{station}' in all stations. (Entrance {self})")
|
||||
if len(stations) > 1:
|
||||
print(f" # MULTIPLE stations found with same name '{station}' in Entrance {self}:")
|
||||
for s in stations:
|
||||
print(f" # {s.id=} - {s.name} {s.latlong()}") # .id is Django internal field, not one of ours
|
||||
return stations[0]
|
||||
@ -357,6 +360,8 @@ class Entrance(TroggleModel):
|
||||
|
||||
def tag(self):
|
||||
return self.single(self.tag_station)
|
||||
def other(self):
|
||||
return self.single(self.other_station)
|
||||
|
||||
def needs_surface_work(self):
|
||||
return self.findability != "S" or not self.has_photo or self.marking != "T"
|
||||
@ -372,6 +377,11 @@ class Entrance(TroggleModel):
|
||||
rs.append(e.cave)
|
||||
return rs
|
||||
|
||||
def firstcave(self):
|
||||
for e in CaveAndEntrance.objects.filter(entrance=self):
|
||||
if e.cave:
|
||||
return(e.cave)
|
||||
|
||||
def get_file_path(self):
|
||||
return Path(settings.ENTRANCEDESCRIPTIONS, self.filename)
|
||||
|
||||
|
@ -174,9 +174,7 @@
|
||||
{% if ent.entrance.explorers %}
|
||||
<dt>Explorers</dt><dd>{{ ent.entrance.explorers|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.northing %}
|
||||
<dt>Location</dt><dd> Easting: {{ ent.entrance.easting|safe }}, Northing: {{ ent.entrance.northing|safe }} (UTM or BMN, depending...), {{ ent.entrance.alt|safe }}m</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if ent.entrance.lat_wgs84 %}
|
||||
<dt>Location</dt><dd><a href="https://www.openstreetmap.org/?mlat={{ ent.entrance.lat_wgs84|floatformat:7}}&mlon={{ent.entrance.long_wgs84|floatformat:7}}">WGS84 Lat.: {{ ent.entrance.lat_wgs84|floatformat:7 }} N, Long.:{{ ent.entrance.long_wgs84|floatformat:7 }} E</a></dd>
|
||||
{% endif %}
|
||||
|
@ -7,14 +7,27 @@
|
||||
|
||||
<h1>Entrance Index</h1>
|
||||
|
||||
{% for entrance in entrances %}{% if entrance.lat_wgs84 %}<a href="{{ entrance.firstcave.url }}">{{ entrance }}</a> has "floating" lat/long <em>{{entrance.lat_wgs84}} N, {{entrance.long_wgs84}} E</em> instead of having a proper tag station or other station<br />{% endif %}{% endfor %}
|
||||
<p>
|
||||
<table>
|
||||
<theader>
|
||||
<tr><th>Name</th><th>Caves</th><th>Point</th><th>Position</th></tr>
|
||||
<tr><th>Entrance</th><th>Caves</th><th>Point</th><th>Tag Position</th><th>Other</th></tr>
|
||||
</theader>
|
||||
<tbody>
|
||||
<ul>
|
||||
{% for entrance in entrances %}
|
||||
<tr><td>{{ entrance }}</td><td>{% for cave in entrance.cavelist %}<a href="{{ cave.url }}">{{ cave }}</a>{% endfor %}</td><td>{{ entrance.best_station }}</td><td>{{ entrance.latlong }}</td></tr>
|
||||
<tr><td>{{ entrance }}</td><td>{% for cave in entrance.cavelist %}<a href="{{ cave.url }}">{{ cave }}</a>{% endfor %}</td><td>
|
||||
{% if entrance.best_station%}
|
||||
{{ entrance.best_station }}
|
||||
{% endif %}</td>
|
||||
<td>{% if entrance.tag %}
|
||||
<a href="https://www.openstreetmap.org/?mlat={{ entrance.tag.latlong.0|floatformat:7}}&mlon={{entrance.tag.latlong.1|floatformat:7}}">{{ entrance.tag.latlong.0|floatformat:5}} N, {{ entrance.tag.latlong.1|floatformat:5 }} E</a>
|
||||
{% endif %}</td>
|
||||
|
||||
<td>{% if entrance.other %}
|
||||
<a href="https://www.openstreetmap.org/?mlat={{ entrance.other.latlong.0|floatformat:7}}&mlon={{entrance.other.latlong.1|floatformat:7}}">{{ entrance.other.latlong.0|floatformat:5}} N, {{ entrance.other.latlong.1|floatformat:5 }} E</a>
|
||||
{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user