mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 18:37:11 +00:00
Revised text on pending cave creation
This commit is contained in:
134
parsers/caves.py
134
parsers/caves.py
@@ -35,10 +35,6 @@ todo = """
|
||||
re.findall("<%(itemname)s>(.*?)</%(itemname)s>" % {"itemname": itemname}, text, re.S)
|
||||
in modern form and pre-compile it.
|
||||
|
||||
- crashes on MariaDB in databasereset.py on server when deleting Caves and complains Area needs a
|
||||
non null parent, But this is not true. The only solution we have found is to let it crash, then
|
||||
stop and restart MariaDB (requires a logon able to sudo) and then restart the databasereset.py
|
||||
again. (status as of July 2022). May not happen now that class Area is removed (Sept.2023).
|
||||
"""
|
||||
AREACODES = {"1623", "1624", "1626", "1627"} # NB set not dict
|
||||
ARGEAREAS = {"1626", "1627", "1624"} # NB set not dict
|
||||
@@ -75,18 +71,7 @@ def report_absent_entrace(id, slug, cave, msg="DUMMY"):
|
||||
|
||||
Called when the Entrance field in a cave_data file is either missing or
|
||||
holds a null string instead of a filename.
|
||||
|
||||
Previously, the lack of an entrance where an entrance was expected, caused troggle to crash in several places.
|
||||
But it is more robust now, so this is not necessary... we hope.
|
||||
|
||||
Also, Cave and Entrance editing now expects there to be a real file (since April 2023), so creating this
|
||||
dummy is actually harmful. So this is commented out, pending removal after further experience.
|
||||
|
||||
global variable entrances_xslug is simply a cache of references to Entrance objects
|
||||
to speed things up when parsing a lot of caves and entrances. All DB actions are time-consuming
|
||||
so
|
||||
"""
|
||||
global entrances_xslug
|
||||
message = f" - Note: Missing Entrance for entrance '{id}' on cave '{cave}' - Is this a problem?"
|
||||
print(message)
|
||||
DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.url}")
|
||||
@@ -105,25 +90,13 @@ def create_new_cave(svxpath, svxid=None, msg=None):
|
||||
# e.g. svxpath = "caves-1623/666/beast" .svx - from the *inlcude tree
|
||||
# e.g. svxid = "caves-1623/666/beast"
|
||||
print(f"Create new cave at {svxpath} - {msg}")
|
||||
#
|
||||
survex_file = ""
|
||||
if svxid:
|
||||
sv = Path(settings.SURVEX_DATA, svxid + ".svx")
|
||||
if sv.is_file:
|
||||
survex_file = svxid + ".svx"
|
||||
sv = svxid
|
||||
else:
|
||||
sv = Path(settings.SURVEX_DATA, svxpath + ".svx")
|
||||
if sv.is_file:
|
||||
survex_file = svxpath + ".svx"
|
||||
|
||||
if survex_file:
|
||||
# message = f"Found a survex file {survex_file=} {svxpath=} {svxid=} "
|
||||
# DataIssue.objects.create(parser="caves", message=message)
|
||||
# print(message, file=sys.stderr)
|
||||
# print(message)
|
||||
pass
|
||||
else:
|
||||
message = f"NOT found a survex file {svxpath=} {svxid=}"
|
||||
sv = svxpath
|
||||
survex_file = settings.SURVEX_DATA / sv / ".svx"
|
||||
if not survex_file.is_file:
|
||||
message = f"NOT found a survex file {sv} in create_new_cave() {svxpath=} {svxid=}"
|
||||
DataIssue.objects.create(parser="caves", message=message)
|
||||
print(message, file=sys.stderr)
|
||||
print(message)
|
||||
@@ -306,43 +279,68 @@ def do_pending_cave(slug, caveid, url, areacode, msg=None):
|
||||
DataIssue.objects.create(parser="caves", message=message, url=url)
|
||||
print(message)
|
||||
return
|
||||
default_note = f"""
|
||||
This cave in is the "pending" state.
|
||||
<p>This can happen for 3 reasons:
|
||||
<ul>
|
||||
<li>A reference has been found to this cave id in a survex file, [MOST LIKELY]
|
||||
<li>or on a wallet,
|
||||
<li>or this cave id is listed in the "pending caves" list.
|
||||
</ul>
|
||||
but no <em>Cave Description</em> exists yet [see below]. <p>
|
||||
|
||||
default_note = "A reference has been found to this cave id in a survex file in the loser repo, or in a wallet metadata"
|
||||
default_note += " in a JSON file in the drawings repo, but no Cave Description exists in expoweb (in /cave_data/)<br><br><br>\n"
|
||||
default_note += "INSTRUCTIONS: FIRST read the notes in <a href='/cave_data/pendingcaves.txt'>pendingcaves.txt</a><br />"
|
||||
default_note += "Next open 'This survex file' (link above the CaveView panel) to find the date and info. Then "
|
||||
default_note += '<br><br>\n\n - (0) look in the <a href="/noinfo/cave-number-index">cave number index</a> for notes on this cave, '
|
||||
default_note += "<br><br>\n\n - (1) search in the survex file for the *ref to find a "
|
||||
default_note += "relevant wallet, e.g.<a href='/survey_scans/2009%252311/'>2009#11</a> and read the notes image files <br>\n - "
|
||||
default_note += (
|
||||
"<br><br>\n\n - (2) search in the Expo for that year e.g. <a href='/expedition/2009'>2009</a> to find a "
|
||||
)
|
||||
default_note += "relevant logbook entry, remember that the date may have been recorded incorrectly, "
|
||||
default_note += (
|
||||
"so check for trips i.e. logbook entries involving the same people as were listed in the survex file, "
|
||||
)
|
||||
default_note += (
|
||||
"and you should also check the scanned copy of the logbook (linked from each logbook entry page) "
|
||||
)
|
||||
default_note += "just in case a vital trip was not transcribed, then <br>\n - "
|
||||
default_note += (
|
||||
"click on 'Edit this cave' and copy the information you find in the survex file and the logbook"
|
||||
)
|
||||
default_note += "and delete all the text in the 'Notes' section - which is the text you are reading now."
|
||||
default_note += "<br><br>\n\n - Only two fields on this form are essential. "
|
||||
default_note += "Documentation of all the fields on 'Edit this cave' form is in <a href='/handbook/survey/caveentryfields.html'>handbook/survey/caveentryfields</a>"
|
||||
default_note += "<br><br>\n\n - "
|
||||
default_note += "You will also need to create a new entrance from the 'Edit this cave' page. Ignore the existing dummy one, it will evaporate on the next full import."
|
||||
default_note += "<br><br>\n\n - "
|
||||
default_note += "When you Submit it will create a new file in expoweb/cave_data/ "
|
||||
default_note += (
|
||||
"<br><br>\n\n - Now you can edit the entrance info: click on Edit below for the dummy entrance. "
|
||||
)
|
||||
default_note += "and then Submit to save it (if you forget to do this, a dummy entrance will be created for your new cave description)."
|
||||
default_note += "<br><br>\n\n - Finally, you need to find a nerd to edit the file '<var>expoweb/cave_data/pendingcaves.txt</var>' "
|
||||
default_note += (
|
||||
f"to remove the line <br><var>{slug}</var><br> as it is no longer 'pending' but 'done. Well Done."
|
||||
)
|
||||
INSTRUCTIONS: <br />
|
||||
Open 'This survex file' elsewhere on this page to find the date and info. Then
|
||||
<ol>
|
||||
|
||||
<li>search in the survex file (<em>{survex_file}</em>) for the *ref to find
|
||||
a relevant wallet, e.g.<a href='/survey_scans/2009%252311/'>2009#11</a> and
|
||||
read the notes image files n the wallet.
|
||||
<ul>
|
||||
<li>Scroll down to the bottom of the wallet page where you will find a list of logbook entries,
|
||||
wallets and survex files which have all been dated to <em>the same day</em>.
|
||||
Check all these to see if there is any other relevant information about this cave.
|
||||
</ul><br><br>
|
||||
|
||||
<li>search in the Expo for that year e.g. <a href='/logreport/2009'>2009</a> to find a relevant logbook entry,
|
||||
remember that the date may have been recorded incorrectly, so check for trips
|
||||
i.e. logbook entries involving the same people as were listed in the survex file,
|
||||
and you should also check the scanned copy of the logbook (linked from each logbook entry page)
|
||||
just in case a vital trip was not fully transcribed (sketch images are missing for many years in the online logbooks).
|
||||
|
||||
<li>check the <a href="/noinfo/cave-number-index">cave number index</a> just in case there are notes for this cave, <br><br>
|
||||
</ol>
|
||||
Then
|
||||
<ol>
|
||||
<li>click on 'Edit this cave' [menu item on the left hand side of this page] to type in the <em>Cave Description</em>
|
||||
and copy the information you find in the survex file, the wallet and the logbook and
|
||||
delete all the dummy default text in the 'Notes' section of the <em>Cave Description</em> - which is the text you are reading now.
|
||||
|
||||
<li>Read the documentation of all the fields on 'Edit this cave' form.
|
||||
It is in <a href='/handbook/survey/caveentryfields.html'>handbook/survey/caveentryfields</a><br><br>
|
||||
|
||||
<li>You will also need to create a new entrance from the 'Edit this cave' page.
|
||||
Ignore the existing dummy one, it will evaporate on the next full import.<br><br>
|
||||
|
||||
<li>When you Submit the Cave form it will create a new file in expoweb/cave_data/ <br><br>
|
||||
|
||||
<li><em>Only now</em> can you edit the entrance info:
|
||||
click on Edit below for the dummy entrance. and then Submit to save it.<br><br>
|
||||
|
||||
- Finally, if there was an entry in the pending list,
|
||||
edit the file '<var>expoweb/cave_data/pendingcaves.txt</var>' to remove
|
||||
the line referring to <br><var>{caveid}</var><br> as it is no longer 'pending' but 'done'.
|
||||
Do this using this link: <a href="/cave_data/pendingcaves.txt_edit">edit the pending list</a>. Well Done.
|
||||
</ol>
|
||||
|
||||
<h4>Explanatory footnote</h4>
|
||||
A reference to this cave would be in
|
||||
</ul>
|
||||
<li>A survex file, which is stored in the <var>:loser:</var> repo.
|
||||
<li>A wallet, which is stored in the <var>walletjson</var> folder inside the <var>:drawings:</var> repo.
|
||||
<li> the pending caves file in the <var>:expoweb:</var> repo. Read the notes in <a href='/cave_data/pendingcaves.txt'>pendingcaves.txt</a>
|
||||
</ul>
|
||||
"""
|
||||
urltest = Cave.objects.filter(url=url)
|
||||
if urltest:
|
||||
message = f" ! Cave {urltest[0]} already exists with this url {url}. Can't create new cave {slug}"
|
||||
|
||||
Reference in New Issue
Block a user