Skip to content

Commit

Permalink
if zero results and anonymous, mention threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
gsfk committed Jan 9, 2024
1 parent 3d8a739 commit 170d79d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bento_beacon/utils/beacon_response.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from flask import current_app, g, request
from .katsu_utils import search_summary_statistics, overview_statistics
from .censorship import get_censorship_threshold, censored_count
from .censorship import get_censorship_threshold, censored_count, no_results_censorship_message
from .exceptions import InvalidQuery, APIException
from ..constants import GRANULARITY_BOOLEAN, GRANULARITY_COUNT, GRANULARITY_RECORD

Expand Down Expand Up @@ -107,6 +107,8 @@ def build_query_response(ids=None, numTotalResults=None, full_record_handler=Non
granularity = response_granularity()
count = len(ids) if numTotalResults is None else numTotalResults
returned_count = censored_count(count)
if returned_count == 0 and not g.permission_query_data:
add_info_to_response(no_results_censorship_message())
if granularity == GRANULARITY_BOOLEAN:
return beacon_boolean_response(returned_count)
if granularity == GRANULARITY_COUNT:
Expand Down

0 comments on commit 170d79d

Please sign in to comment.