Skip to content

Commit

Permalink
fix(cantusindex): fix typing in CISearchView
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmarchd01 committed Jun 18, 2024
1 parent 676268d commit 71823a6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions django/cantusdb_project/main_app/views/chant.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,17 +888,20 @@ def get_context_data(self, **kwargs):
search_term: str = kwargs["search_term"]
search_term: str = search_term.replace(" ", "+") # for multiple keywords

text_search_results: Optional[list[dict]] = get_ci_text_search(search_term)
text_search_results: Optional[list[Optional[dict]]] = get_ci_text_search(
search_term
)

cantus_id = []
genre = []
full_text = []

if text_search_results:
for result in text_search_results:
cantus_id.append(result["cid"])
genre.append(result["genre"])
full_text.append(result["fulltext"])
if result:
cantus_id.append(result.get("cid", None))
genre.append(result.get("genre", None))
full_text.append(result.get("fulltext", None))

if len(cantus_id) == 0:
context["results"] = [["No results", "No results", "No results"]]
Expand Down

0 comments on commit 71823a6

Please sign in to comment.