Commit bebc17fe authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Applied hotfix for not configured schema name uses.

parent 7fa7654c
......@@ -40,6 +40,8 @@ from urllib.parse import urlparse
from onelogin.saml2.auth import OneLogin_Saml2_Auth
from onelogin.saml2.utils import OneLogin_Saml2_Utils
import app.config as config
# based on machine's hostname use different config files for SAML
# TODO switch to use environment variables: PRODUCTION, STAGING, DEVELOPMENT
hostname = socket.gethostname()
......@@ -269,32 +271,6 @@ def get_material(material_id):
@api.route('/materials/<int:material_id>/groups', methods=['GET'])
@http_auth.login_required
def get_calcs_groups(material_id):
# query_method = """
# select *
# from (
# select method_hash,
# material_hash,
# count(*) nr_of_calculations,
# array_agg(calc.id) as calculations_list
# from p34.material
# join p34.calc on material.id = calc.material_id
# join p34.energy on calc.id = energy.calc_id
# where material.id = %s
# and energy.e_kind='Total E'
# group by material_hash,
# method_hash
# having count(*) > 1
# ) d
# cross join lateral (
# select energy.calc_id representative_calculation_id,
# energy.e_val energy_minimum
# from p34.energy
# where energy.calc_id = any(d.calculations_list)
# and energy.e_kind='Total E'
# order by energy.e_val
# limit 1
# ) last_energy;
# """
query_eos = """
select *
from (
......@@ -303,9 +279,9 @@ def get_calcs_groups(material_id):
group_eos_hash,
count(*) nr_of_calculations,
array_agg(calc.id order by calc.cell_volume) as calculations_list
from p34.material
join p34.calc on material.id = calc.material_id
join p34.energy on calc.id = energy.calc_id
from __schema__.material
join __schema__.calc on material.id = calc.material_id
join __schema__.energy on calc.id = energy.calc_id
where material.id = %s
and energy.e_kind='Total E'
group by material_hash,
......@@ -315,13 +291,13 @@ def get_calcs_groups(material_id):
cross join lateral (
select energy.calc_id representative_calculation_id,
energy.e_val energy_minimum
from p34.energy
from __schema__.energy
where energy.calc_id = any(d.calculations_list)
and energy.e_kind='Total E'
order by energy.e_val
limit 1
) last_energy;
"""
""".replace('__schema__', config.schema)
query_convergence = """
select *
from (
......@@ -330,9 +306,9 @@ def get_calcs_groups(material_id):
group_parametervariation_hash,
count(*) nr_of_calculations,
array_agg(calc.id order by energy.e_val) as calculations_list
from p34.material
join p34.calc on material.id = calc.material_id
join p34.energy on calc.id = energy.calc_id
from __schema__.material
join __schema__.calc on material.id = calc.material_id
join __schema__.energy on calc.id = energy.calc_id
where material.id = %s
and energy.e_kind='Total E'
group by material_hash,
......@@ -348,7 +324,7 @@ def get_calcs_groups(material_id):
order by energy.e_val
limit 1
) last_energy;
"""
""".replace('__schema__', config.schema)
# we renamed group_convergencetest_hash_hash to group_parametervariation_hash
# so, perhaps some var renaming should be done here
mat_id = "{}".format(material_id)
......
Supports Markdown
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