Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OSUG
RESIF
ws-statistics
Commits
987de189
Commit
987de189
authored
Jun 24, 2020
by
Jerome Touvier
Browse files
exclude station summary result
parent
3bb84bd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
apps/model.py
View file @
987de189
...
...
@@ -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
...
...
apps/output.py
View file @
987de189
...
...
@@ -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
]:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment