Skip to content

Commit

Permalink
Fix sort_tables in API and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ximenesuk committed Mar 5, 2024
1 parent 147cf0f commit d9fbb5b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ async def convert(background_tasks: BackgroundTasks,
if not files[0].filename:
raise InvalidPayloadError(request)
RESULTS = 'results'
sorting_strategy = None
if sort_tables:
sorting_strategy = 'alphabetical'
tmp_dir = Path(tempfile.mkdtemp())
results_dir = tmp_dir / RESULTS
results_dir.mkdir()
Expand All @@ -271,7 +274,7 @@ async def convert(background_tasks: BackgroundTasks,
contents = await file.read()
local_file = tmp_dir / file.filename
local_file.write_bytes(contents)
converted, result = conversion.convert(local_file, results_dir, sort_tables=sort_tables)
converted, result = conversion.convert(local_file, results_dir, sorting_strategy=sorting_strategy)
log = validation.to_plain_text(result)
f.write(log)
f.write('\n' + '=' * 80 + '\n')
Expand Down

0 comments on commit d9fbb5b

Please sign in to comment.