Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Jul 31, 2024
1 parent 782f65c commit d68e292
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/collective/feedback/restapi/services/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,19 @@ def get_data(self):

has_undread = query.get("has_unread", None)

if has_undread in ("true", "false"):
has_undread = not (has_undread == "false") and has_undread == "true"
else:
has_undread = None

for uid, feedback in feedbacks.items():
# avg calculation
feedback["vote"] = feedback.pop("vote_sum") / feedback.pop("vote_num")

# Use has_unread filter
if has_undread is not None:
if has_undread in ("true", "false"):
has_undread = not (has_undread == "false") and has_undread == "true"

if feedback["has_unread"] != has_undread:
pages_to_remove.append(uid)
if feedback["has_unread"] != has_undread:
pages_to_remove.append(uid)

for uid in pages_to_remove:
del feedbacks[uid]
Expand Down

0 comments on commit d68e292

Please sign in to comment.