Everything working pretty well.

This commit is contained in:
Landon Wark
2024-02-20 14:36:58 -06:00
parent a7e915995e
commit 1e711149f1
14 changed files with 62 additions and 37 deletions

View File

@@ -133,10 +133,10 @@ class RSLNamer(object):
else:
today = data['submitted_date']
else:
today = re.search(r"\d{4}(_|-)?\d{2}(_|-)?\d{2}", data['rsl_plate_num'])
try:
today = re.search(r"\d{4}(_|-)?\d{2}(_|-)?\d{2}", data['rsl_plate_num'])
today = parse(today.group())
except AttributeError:
except (AttributeError, KeyError):
today = datetime.now()
if "rsl_plate_num" in data.keys():
plate_number = data['rsl_plate_num'].split("-")[-1][0]

View File

@@ -642,7 +642,14 @@ class PydSubmission(BaseModel, extra='allow'):
new_item = {}
new_item['type'] = k
new_item['location'] = excel_map['info'][k]
new_item['value'] = v['value']
match k:
case "comment":
if v['value'] is not None:
new_item['value'] = "--".join([comment['text'] for comment in v['value']])
else:
new_item['value'] = None
case _:
new_item['value'] = v['value']
new_info.append(new_item)
except KeyError:
logger.error(f"Unable to fill in {k}, not found in relevant info.")