mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-05-22 18:46:03 +01:00
all working except cave edit url
This commit is contained in:
+43
-3
@@ -22,6 +22,8 @@ from troggle.core.utils import (
|
||||
is_identified_user,
|
||||
write_and_commit,
|
||||
)
|
||||
from troggle.core.views.caves import get_cave_from_slug
|
||||
|
||||
# TO DO check if wallet already exists and if so put a blue label against it & check names are same people
|
||||
# assuming this is a new wallet for now - so add a check for this?
|
||||
|
||||
@@ -384,11 +386,12 @@ def new_hole(request):
|
||||
editor = git_string(editor)
|
||||
|
||||
if valid_area:
|
||||
process_new_hole(form, area)
|
||||
cave_id = process_new_hole(form, area)
|
||||
|
||||
messages.success(request, "New prospect save data successfully saved.")
|
||||
messages.success(request, "New prospect {cave_id} data successfully saved.")
|
||||
|
||||
success_url = "/walletedit/" + form.cleaned_data.get('survey_wallet').replace("#",":")
|
||||
success_url = f"/newholenext/{cave_id}"
|
||||
return redirect(success_url)
|
||||
else:
|
||||
# not in 1623 or 1626
|
||||
@@ -542,7 +545,7 @@ def process_new_hole(form, area):
|
||||
# SurvexStation objects are x/y/x in UTM and have a function to return lat/long which is a bit silly for many uses
|
||||
# _new_location(fix_id)
|
||||
_newwallet(form, area, editor)
|
||||
return
|
||||
return f"{area}-{cave_id}"
|
||||
|
||||
def _newfix(form, area, editor, cave_id, fix_id_basic):
|
||||
"""Constructs and does the edits to the auto GPS file in the loser repo
|
||||
@@ -597,10 +600,12 @@ def _newent(form, areacode, editor, fix_id, cave):
|
||||
marking = "T" # tag
|
||||
else:
|
||||
marking="U" # Unmarked
|
||||
wallet = form.cleaned_data.get("survey_wallet")
|
||||
ent = Entrance.objects.create( # creates object
|
||||
slug=slug,
|
||||
filename = slug + ".html",
|
||||
findability="S", # Coordinates, Surveyed
|
||||
findability_description=wallet,
|
||||
marking=marking,
|
||||
approach= form.cleaned_data.get("approach"),
|
||||
entrance_description=form.cleaned_data.get("entrance_description"),
|
||||
@@ -671,3 +676,38 @@ def _savecave(form, areacode, editor, cave):
|
||||
|
||||
def _newwallet(form, areacode, editor):
|
||||
return
|
||||
|
||||
from datetime import datetime
|
||||
from django.db.models import Q
|
||||
from troggle.core.models.logbooks import LogbookEntry
|
||||
from troggle.core.models.survex import SurvexFile
|
||||
from troggle.core.models.wallets import Wallet
|
||||
|
||||
@login_required_if_public
|
||||
def new_hole_next(request, cave_id):
|
||||
# extract the information from the Cave and Entrance instead of encoding it in the URL
|
||||
cave = get_cave_from_slug(cave_id)
|
||||
name = cave.official_name
|
||||
area = cave_id[:4]
|
||||
cave_name = cave_id[5:]
|
||||
ent = cave.entrances()[0].entrance
|
||||
datevisit = ent.lastvisit # string
|
||||
wallet = ent.findability_description
|
||||
wallet_url = wallet.replace("#", ":")
|
||||
|
||||
try:
|
||||
odate = datetime.strptime(datevisit.replace(".", "-"), "%Y-%m-%d").date()
|
||||
date = odate.isoformat()
|
||||
year = odate.year
|
||||
except:
|
||||
year = cave_name[:4]
|
||||
date = "2025-07-21"
|
||||
|
||||
trips = LogbookEntry.objects.filter(date=date)
|
||||
wallets = Wallet.objects.filter(Q(survexblock__date=date) | Q(walletdate=date)).distinct()
|
||||
svxothers = SurvexFile.objects.filter(survexblock__date=date).distinct()
|
||||
|
||||
return render(request, 'new_hole_next.html',
|
||||
{'cave_id': cave_id, "area": area, "cave_name": cave_name, "name": name, "cave": cave, "ent": ent,
|
||||
"date": date, "trips": trips, "svxothers": svxothers, "wallet_url": wallet_url,
|
||||
"wallet": wallet, "wallets": wallets, "year": year})
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
{% extends "cavebase.html" %}
|
||||
|
||||
{% block title %}New Cave & Entrance & Wallet Update Form{% endblock %}
|
||||
|
||||
{% block extraheaders %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>New Cave {{cave_id}} & Entrance & Wallet Update</h1>
|
||||
|
||||
<h2>Instructions</h2>
|
||||
<p>If you have not done this before, read <a href="/handbook/survey/newcave.html">New Cave Process</a>.
|
||||
|
||||
|
||||
|
||||
<h2>{{area}}/{{cave_name}} <em>{{name}}</em> </h2>
|
||||
|
||||
|
||||
<h4>Entrance photos and description</h4>
|
||||
Edit the Entrance <a href="/{{cave_id}}:{{cave_id}}_entrance_edit">{{cave_name}}</a>
|
||||
to upload the photos<br />
|
||||
|
||||
<h4>Wallet on {{date}}</h4>
|
||||
Edit the Wallet <a href="/survey_scans/{{wallet_url}}/">{{wallet}}</a>
|
||||
to upload the screenshot(s) of the GPSTest screen in situ<br />
|
||||
and scanned hand-drawn sketches of the entrance location.
|
||||
|
||||
<h4>GPS track upload</h4>
|
||||
Upload GPX files into <a href="/gpxupload/{{year}}">/gpslogs/{{year}}/</a>
|
||||
|
||||
<h4>Survex file upload</h4>
|
||||
Cut & paste it in here <a href="/survexfile/caves-{{area}}/{{cave_name}}/{{cave_name}}.svx">
|
||||
caves-{{area}}/{{cave_name}}/{{cave_name}}.svx</a>
|
||||
|
||||
<h4>Logbook entry on {{date}}</h4>
|
||||
If you have already created a logbook entry then it will be listed below under "On this day"
|
||||
and you can click on the link to edit and add to it.<br >
|
||||
Otherwise, create <a href="/logbookedit/{{year}}">new logbook entry</a>
|
||||
<p>Instructions for making <a href="/handbook/logbooks.html">a new logbook entry</a>.
|
||||
|
||||
<h4>Cave description {{area}}/{{cave_name}}</h4>
|
||||
[This is crashing with duplicate caves found when newly created - fix!]<br />
|
||||
🚧 under construction
|
||||
<p>Edit data for the <a href="{%url 'edit_cave' area cave_id%}">{{cave_name}}</a>
|
||||
cave itself.
|
||||
|
||||
<h3>On this day</h3>
|
||||
<span style="font-family: monospace; font-size: 120%; ">
|
||||
{{date}}<br />
|
||||
{% include 'onthisdate.html' %}
|
||||
</span>
|
||||
<h3>Already done:</h3>
|
||||
|
||||
<ul>
|
||||
<li>Inserted a <span style="font-variant: small-caps;">fixed point</span> *fix record
|
||||
<li>Created a new Cave record
|
||||
<li>Created a new Entrance record on that Cave
|
||||
<li>Written and committed those to permanent files.
|
||||
</ul>
|
||||
|
||||
</p>
|
||||
<h4>Why we asked for the time the GPS was recorded</h4>
|
||||
<p>Because ionospheric disturbance happens on a scale of an hour or so, every few hours,
|
||||
and is local to an area about ~50km in size. If we continuously record the GPS position
|
||||
of the potato hut during the expo then we will know if the GPS
|
||||
position of this cave entrancce was recorded during one of these "bad" periods.</p>
|
||||
<p>Go back and re-record the GPS position the next day at the exact same point and put that data in the logbook.</p>
|
||||
{% endblock %}
|
||||
@@ -7,7 +7,7 @@ from django.urls import include, path, re_path
|
||||
from troggle.core.views import survex
|
||||
|
||||
from troggle.core.views.auth import expologin, expologout
|
||||
from troggle.core.views.new_hole import new_hole
|
||||
from troggle.core.views.new_hole import new_hole, new_hole_next
|
||||
from troggle.core.views.caves import (
|
||||
cave3d,
|
||||
cave_debug,
|
||||
@@ -260,6 +260,7 @@ trogglepatterns = [
|
||||
|
||||
# New hole data input
|
||||
path('newhole', new_hole, name="newhole"),
|
||||
path('newholenext/<slug:cave_id>', new_hole_next, name="newholenext"),
|
||||
# Cave description pages
|
||||
path('cave/<slug:slug>', caveslugfwd, name="caveslugfwd"),
|
||||
path('cave_debug', cave_debug, name="cave_debug"),
|
||||
|
||||
Reference in New Issue
Block a user