mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-01 20:48:23 +08:00
Remove empty children from extents
This commit is contained in:
parent
bdcc7939ad
commit
f4bf2ab75f
2 changed files with 4 additions and 13 deletions
|
@ -116,7 +116,7 @@ class Report < ApplicationRecord
|
||||||
'type_of' => element[:type_of] || element[:type_of_lambda].call(object),
|
'type_of' => element[:type_of] || element[:type_of_lambda].call(object),
|
||||||
'id' => { element[:id_key] => object.id },
|
'id' => { element[:id_key] => object.id },
|
||||||
'sort_order' => element[:sort_order],
|
'sort_order' => element[:sort_order],
|
||||||
'children' => gen_element_content(object, element[:children])
|
'children' => gen_element_content(object, element[:children] || [])
|
||||||
}
|
}
|
||||||
hash_object['id'][element[:parent_id_key]] = parent.id if element[:parent_id_key]
|
hash_object['id'][element[:parent_id_key]] = parent.id if element[:parent_id_key]
|
||||||
hash_object
|
hash_object
|
||||||
|
|
|
@ -45,7 +45,6 @@ class Extends
|
||||||
{
|
{
|
||||||
type_of: 'project_header',
|
type_of: 'project_header',
|
||||||
id_key: 'project_id',
|
id_key: 'project_id',
|
||||||
children: []
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type_of: 'experiment',
|
type_of: 'experiment',
|
||||||
|
@ -60,7 +59,6 @@ class Extends
|
||||||
{
|
{
|
||||||
type_of: 'my_module_protocol',
|
type_of: 'my_module_protocol',
|
||||||
id_key: 'my_module_id',
|
id_key: 'my_module_id',
|
||||||
children: []
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type_of: 'step',
|
type_of: 'step',
|
||||||
|
@ -71,25 +69,21 @@ class Extends
|
||||||
type_of: 'step_asset',
|
type_of: 'step_asset',
|
||||||
relation: %w(assets),
|
relation: %w(assets),
|
||||||
id_key: 'asset_id',
|
id_key: 'asset_id',
|
||||||
children: []
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type_of: 'step_table',
|
type_of: 'step_table',
|
||||||
relation: %w(tables),
|
relation: %w(tables),
|
||||||
id_key: 'table_id',
|
id_key: 'table_id',
|
||||||
children: []
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type_of: 'step_checklist',
|
type_of: 'step_checklist',
|
||||||
relation: %w(checklists),
|
relation: %w(checklists),
|
||||||
id_key: 'checklist_id',
|
id_key: 'checklist_id',
|
||||||
children: []
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type_of: 'step_comments',
|
type_of: 'step_comments',
|
||||||
id_key: 'step_id',
|
id_key: 'step_id',
|
||||||
sort_order: 'asc',
|
sort_order: 'asc',
|
||||||
children: []
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -104,23 +98,20 @@ class Extends
|
||||||
children: [{
|
children: [{
|
||||||
type_of: 'result_comments',
|
type_of: 'result_comments',
|
||||||
id_key: 'result_id',
|
id_key: 'result_id',
|
||||||
sort_order: 'asc',
|
sort_order: 'asc'
|
||||||
children: []
|
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type_of: 'my_module_activity',
|
type_of: 'my_module_activity',
|
||||||
id_key: 'my_module_id',
|
id_key: 'my_module_id',
|
||||||
sort_order: 'asc',
|
sort_order: 'asc'
|
||||||
children: []
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type_of: 'my_module_repository',
|
type_of: 'my_module_repository',
|
||||||
relation: %w(experiment project assigned_repositories_and_snapshots),
|
relation: %w(experiment project assigned_repositories_and_snapshots),
|
||||||
id_key: 'repository_id',
|
id_key: 'repository_id',
|
||||||
parent_id_key: 'my_module_id',
|
parent_id_key: 'my_module_id',
|
||||||
sort_order: 'asc',
|
sort_order: 'asc'
|
||||||
children: []
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue