mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 12:43:12 +03:00
fix: Condition of no parameters
This commit is contained in:
parent
eab1a0d2fc
commit
7ad43f5a6d
1 changed files with 8 additions and 4 deletions
|
@ -40,8 +40,11 @@ app.middleware('http')(PlausibleAnalytics())
|
|||
async def get_chart(
|
||||
response: Response,
|
||||
request: Request,
|
||||
from_currency: str = None,
|
||||
conv_currency: str = None,
|
||||
start_date: str = None,
|
||||
end_date: str = None,
|
||||
):
|
||||
from_currency, conv_currency, start_date, end_date = None, None, None, None
|
||||
|
||||
if not from_currency or not conv_currency:
|
||||
response.status_code = status.HTTP_400_BAD_REQUEST
|
||||
|
@ -76,10 +79,11 @@ async def get_chart(
|
|||
async def get_chart_period(
|
||||
response: Response,
|
||||
request: Request,
|
||||
from_currency: str = None,
|
||||
conv_currency: str = None,
|
||||
period: str = None,
|
||||
):
|
||||
|
||||
from_currency, conv_currency, period = None, None, None
|
||||
|
||||
if not from_currency or not conv_currency:
|
||||
response.status_code = status.HTTP_400_BAD_REQUEST
|
||||
return {
|
||||
|
@ -124,7 +128,7 @@ async def get_chart_period(
|
|||
}
|
||||
|
||||
|
||||
async def create_chart(from_currency: str, conv_currency: str, start_date: str, end_date: str) -> (str, bool):
|
||||
async def create_chart(from_currency: str, conv_currency: str, start_date: str, end_date: str) -> str:
|
||||
cur.execute('SELECT date, rate FROM currency WHERE (date BETWEEN %s AND %s) '
|
||||
'AND from_currency = %s AND conv_currency = %s ORDER BY date',
|
||||
[
|
||||
|
|
Loading…
Add table
Reference in a new issue