Skip to content

Commit

Permalink
Merge pull request #60 from maxtruxa/optional-filter-options
Browse files Browse the repository at this point in the history
Fix handling of optional query filter options
  • Loading branch information
LOLINTERNETZ authored May 9, 2024
2 parents 4c387d3 + e55b5da commit f4de4ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vscoffline/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,19 @@ def on_post(self, req, resp):
#flags = vsc.QueryFlags.NoneDefined
criteria = req.media['filters'][0]['criteria']

if req.media['filters'][0]['sortOrder']:
if req.media['filters'][0].get('sortOrder'):
sortorder = vsc.SortOrder(req.media['filters'][0]['sortOrder'])

if req.media['filters'][0]['sortBy']:
if req.media['filters'][0].get('sortBy'):
sortby = vsc.SortBy(req.media['filters'][0]['sortBy'])

# Flags can be used for version management, but it appears the client doesn't care what's sent back
#if req.media['flags']:
# flags = vsc.QueryFlags(req.media['flags'])

# Unused
#pagenumber = req.media['filters'][0]['pageNumber']
#pagesize = req.media['filters'][0]['pageSize']
#pagenumber = req.media['filters'][0].get('pageNumber', 0)
#pagesize = req.media['filters'][0].get('pageSize', 500)
#log.info(f'CRITERIA {criteria}, flags {flags}, sortby {sortby}, sortorder {sortorder}')

# If no order specified, default to InstallCount (e.g. popular first)
Expand Down

0 comments on commit f4de4ba

Please sign in to comment.