Skip to content
Snippets Groups Projects
Commit 7ff39fa3 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

FIX: Fix typos and datamodel problems

parent 9e59dc9f
No related branches found
No related tags found
1 merge request!1F awi sams
......@@ -65,10 +65,10 @@ Container:
obligatory_properties:
Responsible:
ContainerType:
suggested_properties:
container_label:
description: A standardized label for a container
datatype: TEXT
suggested_properties:
Child container:
datatype: LIST<Container>
Container size:
......
......@@ -28,7 +28,7 @@ import json
import logging
import sys
import caosdb as db
import linkahead as db
from caosadvancedtools.serverside import helper
from caosadvancedtools.serverside.logging import configure_server_side_logging
......@@ -126,16 +126,18 @@ def create_container_entities(responsible_id, container_type_id, container_size,
# Post process child containers
batch = post_process_containers(batch)
try:
logger.info(batch)
batch.insert()
except:
logger.error("{}The registered containers could not be imported to the system.{}".format(
except Exception as e:
logger.error("{} The registered containers could not be imported to the system. {}".format(
ERROR_PREFIX, ERROR_SUFFIX))
logger.error(e)
return None
# TODO: Reset the internal_container_label_counter of person to its previous value if nothing has be inserted
# Add to parent container
if parent_container is not None:
child_cont_prop = db.Property(name=get_entity_name("child_container_prop").retrieve()
child_cont_prop = db.Property(name=get_entity_name("child_container_prop")).retrieve()
new_childs=[]
for entity in batch:
new_childs += [entity.id]
......@@ -148,7 +150,7 @@ def create_container_entities(responsible_id, container_type_id, container_size,
parent_container.get_property(child_cont_prop.name).value=new_childs
else:
parent_container.get_property(child_cont_prop.name).value += new_childs
parent_container=post_process_parent_container(parent)
parent_container=post_process_parent_container(parent_container)
parent_container.update()
set_label_counter(container_type_id=container_type_id,
......
......@@ -55,8 +55,8 @@ def get_container_name_prefix(responsible_id: int, container_type_id: int) -> st
Name in the format `<responsible>_<container_type_name>`
"""
resp = db.cached_get_entity_by(eid=responsible_id)
ct = db.cached_get_entity_by(eid=container_type_id)
resp = db.cached.cached_get_entity_by(eid=responsible_id)
ct = db.cached.cached_get_entity_by(eid=container_type_id)
resp_str = get_record_string(resp)
ct_str = get_record_string(ct)
......
......@@ -3,10 +3,12 @@ import yaml
from pathlib import Path
CONSTANTS = yaml.load(os.path.join(Path(__file__).parent, "default_constants.yml"))
with open(os.path.join(Path(__file__).parent, "default_constants.yml")) as yaml_file:
CONSTANTS = yaml.safe_load(yaml_file)
if os.path.isfile(os.path.join(Path(__file__).parent, "constants.yml")):
CONSTANTS.update(yaml.load(os.path.join(Path(__file__).parent, "constants.yml")))
with open(os.path.join(Path(__file__).parent, "constants.yml")) as custom_yaml_file:
CONSTANTS.update(yaml.safe_load(custom_yaml_file))
def get_entity_name(name: str):
......@@ -21,6 +23,6 @@ def get_entity_name(name: str):
def get_column_header_name(name: str):
if name in CONSTANTS["csv_column_names"]:
return CONSTANTS["csv_column_names"]
return CONSTANTS["csv_column_names"][name]
return get_entity_name(name)
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment