Refactor template formatting in records_to_text function

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-08 16:05:59 -03:00
commit 6348da2de3

View file

@ -30,5 +30,5 @@ def records_to_text(template: str, records: list[Record]) -> str:
records = [records]
# Check if there are any format strings in the template
formated_records = [template.format(**record.data) for record in records]
formated_records = [template.format(data=record.data, **record.data) for record in records]
return "\n".join(formated_records)