mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 16:17:10 +00:00
Handling and fixing bad dates in JSON input
This commit is contained in:
@@ -631,14 +631,24 @@ def scanupload(request, path=None):
|
||||
# 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)
|
||||
try:
|
||||
samedate = datetime.date.fromisoformat(datestr)
|
||||
except:
|
||||
try:
|
||||
samedate = datetime.date.fromisoformat(datestr[:10])
|
||||
except:
|
||||
samedate = None
|
||||
|
||||
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)
|
||||
if samedate:
|
||||
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
|
||||
|
||||
else:
|
||||
svxothers = None
|
||||
|
||||
Reference in New Issue
Block a user