sorted reviews in alphabetical order

This commit is contained in:
Anton Lydike 2022-08-07 19:11:45 +02:00
parent dc9676155d
commit c902343c87

View File

@ -324,7 +324,7 @@ if __name__ == '__main__':
reviews = ReviewPostprocessor().process_all(parser.parse())
with open("reviews.json", 'w') as f:
json.dump({
'reviews': reviews,
'reviews': sorted(reviews, key=lambda review: tuple((review[key] or '').lower() for key in ('company', 'name', 'variant'))),
'created': str(datetime.date.today())
}, f, indent=2)
except ParseError as err: