summaryrefslogtreecommitdiffstats
path: root/core/views/wallets_edit.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-07-23 23:30:19 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-07-23 23:30:19 +0300
commit9473b22bd9aa71a23d23c4a0f6f9c88a3b7666f5 (patch)
treef882811e384d9ac0c7ddd1a55182f121fe119f6a /core/views/wallets_edit.py
parent3ea014ec577fef12b946c6120b326e8471009d01 (diff)
downloadtroggle-9473b22bd9aa71a23d23c4a0f6f9c88a3b7666f5.tar.gz
troggle-9473b22bd9aa71a23d23c4a0f6f9c88a3b7666f5.tar.bz2
troggle-9473b22bd9aa71a23d23c4a0f6f9c88a3b7666f5.zip
detect non-ISO dates in JSON and from user and fix
Diffstat (limited to 'core/views/wallets_edit.py')
-rw-r--r--core/views/wallets_edit.py24
1 files changed, 3 insertions, 21 deletions
diff --git a/core/views/wallets_edit.py b/core/views/wallets_edit.py
index 7cf2251..9273fed 100644
--- a/core/views/wallets_edit.py
+++ b/core/views/wallets_edit.py
@@ -18,7 +18,7 @@ from troggle.core.models.caves import Cave
from troggle.core.models.logbooks import LogbookEntry # , PersonLogEntry
from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole
from troggle.core.models.troggle import DataIssue, Expedition
-from troggle.core.models.wallets import Wallet, YEAR_RANGE
+from troggle.core.models.wallets import Wallet, YEAR_RANGE, make_valid_date
from troggle.core.views.auth import login_required_if_public
from troggle.core.views.caves import getCave
@@ -32,7 +32,7 @@ from troggle.parsers.scans import contentsjson
"""
todo = """
-- Nasty bug in navingating to 'previous wallet' when we have a 2-year gap in expos
+- Nasty bug in navigating to 'previous wallet' when we have a 2-year gap in expos
The xxxx#00 wallet is not getting edited correctly. Something is off by one somewhere..
- Register uploaded filenames in the Django db without needing to wait for a reset & bulk file import
@@ -496,25 +496,7 @@ def walletedit(request, path=None):
or thing == "[]"
or thing is None)
- def make_valid_date(date):
- datestr = date.replace(".", "-")
- try:
- samedate = datetime.date.fromisoformat(datestr)
- except ValueError:
- # probably a single digit day number. HACKUS MAXIMUS.
- # clearly we need to fix this when we first import date strings..
- datestr = datestr[:-1] + "0" + datestr[-1]
- # datestr = f"{datestr:02d}"
- print(f"! - ValueError, trying.. {datestr=} ")
- try:
- samedate = datetime.date.fromisoformat(datestr)
- except:
- try:
- samedate = datetime.date.fromisoformat(datestr[:10])
- except:
- print(f"! - ValueError, FAILED {datestr=} ")
- samedate = None
- return samedate
+
def scan_survexblocks(svxfile):
"""Scans for *team people attached to all the survex blocks in this svxfile