mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Fix bookview gets either any currency or any type
This commit is contained in:
parent
c08c76b7d8
commit
a518daf8cc
12
api/views.py
12
api/views.py
@ -1,3 +1,4 @@
|
||||
from re import T
|
||||
from rest_framework import status, viewsets
|
||||
from rest_framework.generics import CreateAPIView, ListAPIView
|
||||
from rest_framework.views import APIView
|
||||
@ -349,9 +350,14 @@ class BookView(ListAPIView):
|
||||
currency = request.GET.get('currency')
|
||||
type = request.GET.get('type')
|
||||
|
||||
queryset = Order.objects.filter(status=Order.Status.PUB)
|
||||
# Currency 0 and type 2 are special cases treated as "ANY". They are not possible choices.
|
||||
if not (int(currency) == 0 and int(type) == 2):
|
||||
queryset = Order.objects.filter(status=Order.Status.PUB)
|
||||
|
||||
# Currency 0 and type 2 are special cases treated as "ANY". (These are not really possible choices)
|
||||
if int(currency) == 0 and int(type) != 2:
|
||||
queryset = Order.objects.filter(type=type, status=Order.Status.PUB)
|
||||
elif int(type) == 2 and int(currency) != 0:
|
||||
queryset = Order.objects.filter(currency=currency, status=Order.Status.PUB)
|
||||
elif not (int(currency) == 0 and int(type) == 2):
|
||||
queryset = Order.objects.filter(currency=currency, type=type, status=Order.Status.PUB)
|
||||
|
||||
if len(queryset)== 0:
|
||||
|
@ -8,7 +8,7 @@ export default class BookPage extends Component {
|
||||
this.state = {
|
||||
orders: new Array(),
|
||||
currency: 0,
|
||||
type: 2,
|
||||
type: 1,
|
||||
currencies_dict: {"0":"ANY"}
|
||||
};
|
||||
this.getCurrencyDict()
|
||||
|
Loading…
Reference in New Issue
Block a user