Skip to content

Commit

Permalink
fix filter by hash type
Browse files Browse the repository at this point in the history
(it's stored in hashlists as code and not name,
so the filter arg had to change)
  • Loading branch information
OviOvocny committed Dec 18, 2023
1 parent 8948807 commit 4312425
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

hash_list_parser = pagination.copy()
hash_list_parser.add_argument('name', type=str, required=False, help='filter by name')
hash_list_parser.add_argument('hash_type', type=str, required=False, help='filter by hash type')
hash_list_parser.add_argument('hash_type', type=int, required=False, help='filter by hash type code')
hash_list_parser.add_argument('order_by', type=str, required=False, help='result ordering',
choices=['name', 'hash_type']) #'hash_count', 'job_count' maybe later
hash_list_parser.add_argument('descending', type=inputs.boolean, required=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def get(self):
if args.name:
hash_list_query = hash_list_query.filter(FcHashList.name.like('%' + args.name + '%'))

if args.hash_type:
hash_list_query = hash_list_query.filter(FcHashList.hash_type.like('%' + args.hash_type + '%'))
if args.hash_type is not None:
hash_list_query = hash_list_query.filter(FcHashList.hash_type == args.hash_type)

if args.order_by:
orderBy = getattr(FcHashList, args.order_by)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ import HashTypeAutocomplete from './hashTypeAutocomplete.vue'
'order_by': this.orderBy,
'descending': this.dataTableOptions.sortDesc ? this.dataTableOptions.sortDesc[0] : false,
'name': this.search,
'hash_type': this.hash_type ? this.hash_type.name : null,
'hash_type': this.hash_type != null ? this.hash_type.code : null,
'showDeleted': this.isTrash,
}
}).then((response) => {
Expand Down

0 comments on commit 4312425

Please sign in to comment.