Skip to content

Commit

Permalink
CR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
n00rsy committed May 5, 2023
1 parent 0acdd4f commit 81b1036
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pybossa/view/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,15 +1157,10 @@ def add_metadata(name):


def bookmarks_dict_to_array(bookmarks_dict, order_by, desc):
order_by = "name" if order_by is None else order_by
desc = False if desc is None else desc

bookmarks_array = []
for name, meta in bookmarks_dict.items():
b = {'name': name}
b.update(meta)
bookmarks_array.append(b)
order_by = order_by or "name"
desc = desc or False

bookmarks_array = [{'name': name, **meta} for name, meta in bookmarks_dict.items()]
bookmarks_array.sort(key=lambda b: b[order_by], reverse=desc)
return bookmarks_array

Expand Down Expand Up @@ -1239,7 +1234,7 @@ def taskbrowse_bookmarks(user_name, short_name):

order_by = request.args.get('order_by', None, type=str)
desc_str = request.args.get('desc', None)
desc = True if desc_str == 'true' else False if desc_str == 'false' else None
desc = {'true': True, 'false': False}.get(desc_str)

# get bookmarks for project from cache
if request.method == 'GET':
Expand Down

0 comments on commit 81b1036

Please sign in to comment.