Skip to content

Commit

Permalink
Fix to avoid returning many false items if no interactionids found
Browse files Browse the repository at this point in the history
  • Loading branch information
dzaslavskiy committed Oct 12, 2023
1 parent a11271e commit b93d9b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gdrive/export_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging

import fastapi
from pydantic import BaseModel
from pydantic import BaseModel, Field
from fastapi import BackgroundTasks, responses

from gdrive import export_client, client, settings, error
Expand Down Expand Up @@ -121,7 +121,7 @@ class FindModel(BaseModel):

responseId: str
field: str
values: list[str]
values: list[str] = Field(..., min_items=1)
result_field: str | None = None


Expand Down
3 changes: 3 additions & 0 deletions gdrive/export_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ def find(responseId, field, values, result):

all_interactionIds = get_all_InteractionIds(responseId)

if len(all_interactionIds) == 0:
return {"found": []}

all_interactionIds_match = list(
map(lambda res: {"match": {"interactionId": f"{res}"}}, all_interactionIds)
)
Expand Down

0 comments on commit b93d9b0

Please sign in to comment.