lemonadelabs / django-merlin

The web backend for Merlin, written on the Django web framework.
1 stars 0 forks source link

too many attribute strings for entities in JSON response #6

Closed achimgaedke closed 8 years ago

achimgaedke commented 8 years ago

When looking at the JSON response of the merlin-serializer ( http://localhost:8000/api/simulations/1/ ) the attributes field contains always the same list of strings. I'd expect on only one (or a few) strings.

In RecordStorageFacility.py I use TheMaintenance.attributes.add("budget") to add attributes.

Here is a part of the JSON response:

 {
            "id": 6,
            "description": "",
            "name": "maintenance budget",
            "attributes": [
                "capability",
                "external capability",
                "branch",
                "resource",
                "budget",
                "asset"
            ],
            "parent": "http://localhost:8000/api/entities/7/",
            "sim": "http://localhost:8000/api/simulations/1/",
            "is_source": true,
            "children": [],
            "outputs": [
                {
                    "id": 6,
                    "description": "",
                    "name": "maint$_output",
                    "parent": "http://localhost:8000/api/entities/6/",
                    "unit_type": "maint$",
                    "apportion_rule": 2,
                    "endpoints": [
                        {
                            "bias": 1.0,
                            "input": 7,
                            "parent": 6,
                            "sim_output": null
                        }
                    ]
                }
            ],
            "inputs": [],
            "processes": [
                {
                    "id": 6,
                    "description": "",
                    "name": "maintenance budget",
                    "parent": "http://localhost:8000/api/entities/6/",
                    "priority": 1000,
                    "process_class": "pymerlin.processes.BudgetProcess",
                    "properties": [
                        {
                            "id": 8,
                            "description": "",
                            "name": "amount",
                            "default_value": 4000000.0,
                            "max_value": null,
                            "min_value": null,
                            "process": "http://localhost:8000/api/processes/6/",
                            "property_type": 2,
                            "property_value": 4000000.0
                        }
                    ]
                }
            ],
            "display_pos_x": null,
            "display_pos_y": null
        },