Skip to content

Commit

Permalink
Accept all sorting strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
ximenesuk committed Mar 7, 2024
1 parent d481a33 commit e97b0fc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ class Checker(StrEnum):
bgs = "bgs"


# Enum for sorting strategy logic
class SortingStrategy(StrEnum):
default = "default"
alphabetical = "alphabetical"
hierarchy = "hierarchy"
dictionary = "dictionary"


# Enum for pdf response type logic
class ResponseType(StrEnum):
attachment = "attachment"
Expand Down Expand Up @@ -118,10 +126,10 @@ class ResponseType(StrEnum):
)

sort_tables_form = Form(
default='default',
default=SortingStrategy.default,
title='Sort worksheets',
description=('Sort the worksheets into alphabetical order '
'or leave in the order found in the AGS file. '
description=('Sort the worksheets into alphabetical, hierarchical '
'dictionary or default order, that found in the AGS file. '
'This option is ignored when converting to AGS.'),
)

Expand Down Expand Up @@ -276,7 +284,7 @@ async def convert(background_tasks: BackgroundTasks,
:raises Exception: If the conversion fails or an unexpected error occurs.
"""

if sort_tables == 'default':
if sort_tables == SortingStrategy.default:
sort_tables = None
if not files[0].filename:
raise InvalidPayloadError(request)
Expand Down

0 comments on commit e97b0fc

Please sign in to comment.