Everything working pretty well.
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user