Commit 987de189 authored by Jerome Touvier's avatar Jerome Touvier
Browse files

exclude station summary result

parent 3bb84bd9
......@@ -6,7 +6,6 @@ from apps.constants import BOOLEANS
from apps.utils import check_base_parameters
from apps.utils import error_param
from apps.utils import is_valid_country
from apps.utils import is_valid_integer
from apps.utils import is_valid_nodata
from apps.utils import is_valid_orderby
from apps.utils import is_valid_output
......
......@@ -9,7 +9,6 @@ from flask import make_response
from apps.globals import Error
from apps.utils import error_request
from apps.utils import overflow_error
from apps.utils import tictac
......@@ -57,6 +56,7 @@ def sql_request(params):
columns = "year, network, station, channel, quality, type"
s = f"SELECT DISTINCT ON ({columns}) size, {columns}, date FROM dataholdings"
s = sql_common_string(params, s)
s = f"{s} AND channel is not NULL"
if params["type"] != "all":
s = f"""{s} AND (type = '{params["type"]}')"""
......@@ -81,9 +81,9 @@ def sql_request(params):
if params["request"] == "send":
s = f"""{s} AND ({is_like_or_equal(params, "country")})"""
if params["granularity"]:
granularity = "52w" if params["granularity"] == "year" else "4w"
s = f"""{s} , time({granularity})"""
# if params["granularity"]:
# granularity = "52w" if params["granularity"] == "year" else "4w"
# s = f"""{s} , time({granularity})"""
select.append(s)
select = " UNION ".join(select)
return select.replace("?", "_").replace("*", "%")
......@@ -94,7 +94,6 @@ def collect_data(params):
tic = time.time()
logging.debug("Start collecting data...")
print(os.getenv("PG_DBURI"))
with psycopg2.connect(os.getenv("PG_DBURI")) as conn:
logging.debug(conn.get_dsn_parameters())
logging.debug(f"Postgres version : {conn.server_version}")
......@@ -121,7 +120,6 @@ def sum_results(params, data):
for key, val in result.items():
newdata.append([key, str(val)])
elif params["request"] == "send":
print(data)
result = 0
for row in data:
if row[0]:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment