Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to filter tests with warnings #579

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions flask_app/blueprints/rest.py
Expand Up @@ -128,6 +128,9 @@ def _get_iterator(self):
args.session_id = request.view_args.get('session_id')

if args.search:
search_tokens = args.search.split()
if 'has_warnings' in search_tokens and args.session_id is None:
abort(requests.codes.forbidden)
vmalloc marked this conversation as resolved.
Show resolved Hide resolved
returned = get_orm_query_from_search_string('test', args.search, abort_on_syntax_error=True)
else:
returned = super(TestResource, self)._get_iterator().join(Session, Session.id == Test.session_id)
Expand Down
2 changes: 2 additions & 0 deletions flask_app/search/logic.py
Expand Up @@ -130,6 +130,8 @@ def get_base_query(self):

def get_fallback_filter(self, term):
query = TestInformation.name.contains(term)
if term == "has_warnings":
query = query | (Test.num_warnings > 0)
if term == "starred" and current_user and current_user.is_authenticated:
query = query | db.session.query(UserStarredTests).filter(UserStarredTests.user_id == current_user.id, UserStarredTests.test_id == Test.id).exists().correlate(Test)
return query
Expand Down
4 changes: 4 additions & 0 deletions webapp/app/session/index/template.hbs
Expand Up @@ -33,6 +33,10 @@
<td><code>starred</code></td>
<td>Find tests which the current user marked as starred</td>
</tr>
<tr>
<td><code>has_warnings</code></td>
<td>Find tests that has warnings</td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find tests that have warnings

</tr>
</tbody>
</table>
{{/search-bar}}
Expand Down