diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-09-16 21:26:03 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-09-16 21:26:03 +0300 |
commit | ddfc677a1e4852e884bcf117f653479e6de3cc9c (patch) | |
tree | dc4d7665173c060e2f90be8a1fdb24bd471304d5 /core/views/uploads.py | |
parent | 0ab3a4ff443242d7a2ae3e2e2412e7517b01e6fd (diff) | |
download | troggle-ddfc677a1e4852e884bcf117f653479e6de3cc9c.tar.gz troggle-ddfc677a1e4852e884bcf117f653479e6de3cc9c.tar.bz2 troggle-ddfc677a1e4852e884bcf117f653479e6de3cc9c.zip |
bugfix for missing dates
Diffstat (limited to 'core/views/uploads.py')
-rw-r--r-- | core/views/uploads.py | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py index 158da24..975e8f1 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -593,23 +593,29 @@ def scanupload(request, path=None): waldata["description url"]="" # find trips and survex files of the same date - datestr = waldata["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] - print(f' - {datestr=} ') - samedate = datetime.date.fromisoformat(datestr) + if waldata["date"]: + datestr = waldata["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] + print(f' - {datestr=} ') + samedate = datetime.date.fromisoformat(datestr) + + thisexpo = Expedition.objects.get(year=int(year)) + expeditionday = thisexpo.get_expedition_day(samedate) + #print(f' - {thisexpo=} {expeditionday=}') + svxothers = SurvexBlock.objects.filter(expeditionday=expeditionday) + #print(f' - {thisexpo=} {expeditionday=} {svxothers=}') + trips = LogbookEntry.objects.filter(date=samedate) + + else: + svxothers = None + trips = None - trips = LogbookEntry.objects.filter(date=samedate) - thisexpo = Expedition.objects.get(year=int(year)) - expeditionday = thisexpo.get_expedition_day(samedate) - #print(f' - {thisexpo=} {expeditionday=}') - svxothers = SurvexBlock.objects.filter(expeditionday=expeditionday) - #print(f' - {thisexpo=} {expeditionday=} {svxothers=}') - + #Survex and survex complaints, comes from json file on disc, not as pre-populated as above complaints, caveobject = get_complaints([], waldata, svxfiles, files, wallet, wurl) # print(f' - {caveobject=}') |