Skip to content

Commit

Permalink
#1268: Ignore recent query results if user has changed datasets.
Browse files Browse the repository at this point in the history
Show help message and link to Signs Search.
  • Loading branch information
susanodd committed Jul 4, 2024
1 parent d9bd7e3 commit eddec4b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 8 additions & 1 deletion signbank/dictionary/adminviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -6594,7 +6594,11 @@ def get_queryset(self):
if 'search_results' in self.request.session.keys():
search_results = self.request.session['search_results']
if len(search_results) > 0:
if search_results[0]['href_type'] not in ['gloss']:
first_search_result = search_results[0]
first_gloss = Gloss.objects.filter(id__in=[first_search_result['id']]).first()
if first_search_result['href_type'] not in ['gloss']:
search_results = []
if not first_gloss or first_gloss.lemma.dataset not in selected_datasets:
search_results = []
else:
search_results = []
Expand All @@ -6608,6 +6612,9 @@ def get_queryset(self):
if not get:
return glosses_of_dataset

if not glosses_of_dataset:
return glosses_of_dataset

# data structure to store the query parameters in order to keep them in the form
query_parameters = dict()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,13 @@ <h3>{% trans "Batch Edit" %}</h3>
</div>

<div>
<table class='table table-condensed table-toggles'
{% load underscore_to_space %}
{% if not object_list %}
<p>{% trans "No glosses found. Please construct a new query:" %}
<span><a class="btn btn-default"
href='{{PREFIX_URL}}/signs/search/'>{% trans "Search" %}</a></span></p>
{% else %}
<table class='table table-condensed table-toggles'
style="width:100%; overflow-y:scroll;">
<thead>
<tr>
Expand All @@ -315,7 +321,6 @@ <h3>{% trans "Batch Edit" %}</h3>
</tr>
</thead>
<tbody>
{% load underscore_to_space %}
{% for gloss in object_list %}
<tr style="height:auto;">
<td>
Expand Down Expand Up @@ -719,6 +724,7 @@ <h3>{% trans "Batch Edit" %}</h3>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>

Expand Down

0 comments on commit eddec4b

Please sign in to comment.