Update handling for query_kv when no Key is supplied.

This commit is contained in:
eSeR1805 2022-06-13 20:02:06 +03:00
parent be169a23f4
commit f3dee5ec4f
No known key found for this signature in database
GPG Key ID: BA53686259B46936

View File

@ -49,9 +49,9 @@ class KeyValue(_DECL_BASE):
return will be for generic values not tied to a trade
:param trade_id: id of the Trade
"""
key = key if key is not None else "%"
filters = [KeyValue.ft_trade_id == trade_id if trade_id is not None else 0,
KeyValue.kv_key.ilike(key)]
filters = []
filters.append(KeyValue.ft_trade_id == trade_id if trade_id is not None else 0)
if key is not None:
filters.append(KeyValue.kv_key.ilike(key))
return KeyValue.query.filter(*filters)