Moving groups inside macro

This commit is contained in:
Luca Frosini 2023-04-13 10:29:49 +02:00
parent 5cb54d27b9
commit f0eee71fad
1 changed files with 21 additions and 21 deletions

View File

@ -1,4 +1,5 @@
<#assign timeseriesVar = [] >
<#assign groups = [] >
<#macro group groupname var="" include=true sep=",">
<#if var?has_content && include>
@ -57,9 +58,12 @@
</#if>
</#macro>
<#macro timeseries key namespace="" timeseries="" include=include_sensitive sep=",">
<#macro timeseries key namespace="" timeseries="" groupname="" include=include_sensitive sep=",">
<#if timeseries?has_content && .data_model[timeseries]??>
<#assign timeseriesVar += [{"property":"${timeseries}","filename":"${key}"}]>
<#if groupname?has_content>
<#assign groups += ["${groupname}"]>
</#if>
<#if include>
<#local list = .data_model[timeseries] >
<#list list[0..*5] as ts>
@ -106,8 +110,8 @@
<#-- END of Stock Identity Section -->
<#-- Stock Data Section -->
<@timeseries key="Abundance Level" namespace="stock_data" timeseries="abundance_level" />
<@timeseries key="Abundance Level (FIRMS Standard)" namespace="stock_data" timeseries="firms_standard_abundance_level" />
<@timeseries key="Abundance Level" namespace="stock_data" timeseries="abundance_level" groupname="abundance-level-group" />
<@timeseries key="Abundance Level (FIRMS Standard)" namespace="stock_data" timeseries="firms_standard_abundance_level" groupname="abundance-level-firms-standard-group" />
<@metadatalist key="Assessment Method" namespace="stock_data" list=assessment_methods include=include_sensitive />
<#--
assessment_methods will change from list of string to timeseries.
@ -120,15 +124,15 @@
Use the line below in place of the line above
-->
<#-- <@timeseries key="Assessment Method" namespace="stock_data" timeseries="assessment_methods" /> -->
<#-- <@timeseries key="Assessment Method" namespace="stock_data" timeseries="assessment_methods" groupname="assessment-method-group" /> -->
<@metadata key="Assessor" namespace="stock_data" var=assessor include=include_sensitive />
<@timeseries key="Biomass" namespace="stock_data" timeseries="biomass" />
<@timeseries key="Catch" namespace="stock_data" timeseries="catches" />
<@timeseries key="Biomass" namespace="stock_data" timeseries="biomass" groupname="biomass-group" />
<@timeseries key="Catch" namespace="stock_data" timeseries="catches" groupname="catch-group" />
<@metadatalist key="Data Owner" namespace="stock_data" list=data_owner include=include_sensitive />
<@timeseries key="FAO Stock Status Category" namespace="stock_data" timeseries="fao_categories" />
<@timeseries key="Fishing Pressure" namespace="stock_data" timeseries="fishing_pressure" />
<@timeseries key="Fishing Pressure (FIRMS Standard)" namespace="stock_data" timeseries="firms_standard_fishing_pressure" />
<@timeseries key="Landing" namespace="stock_data" timeseries="landings" />
<@timeseries key="FAO Stock Status Category" namespace="stock_data" timeseries="fao_categories" groupname="fao-stock-status-category-group" />
<@timeseries key="Fishing Pressure" namespace="stock_data" timeseries="fishing_pressure" groupname="fishing-pressure-group" />
<@timeseries key="Fishing Pressure (FIRMS Standard)" namespace="stock_data" timeseries="firms_standard_fishing_pressure" groupname="fishing-pressure-firms-standard-group" />
<@timeseries key="Landing" namespace="stock_data" timeseries="landings" groupname="landing-group" />
<@metadatalist key="Scientific Advice" namespace="stock_data" list=scientific_advice include=include_sensitive />
<#--
scientific_advice will change from list of string to timeseries.
@ -141,8 +145,8 @@
Use the line below in place of the line above
-->
<#-- <@timeseries key="Scientific Advice" namespace="stock_data" timeseries="scientific_advice" /> -->
<@timeseries key="State and Trend" namespace="stock_data" timeseries="state_and_trend_of_marine_resources" />
<#-- <@timeseries key="Scientific Advice" namespace="stock_data" timeseries="scientific_advice" groupname="scientific-advice-group" /> -->
<@timeseries key="State and Trend" namespace="stock_data" timeseries="state_and_trend_of_marine_resources" groupname="state-and-trend-group" />
<#-- END of Stock Data Section-->
<#-- Record Info Section -->
@ -162,17 +166,13 @@
<#-- END of Record Info Section -->
],
"groups": [
<@group groupname="abundance-level-group" var=abundance_level />
<@group groupname="abundance-level-firms-standard-group" var=firms_standard_abundance_level />
<#list groups as groupname>
{
"name": "${groupname}"
}<#sep>,</#sep>
</#list>
<@group groupname="assessment-method-group" var=assessment_methods />
<@group groupname="biomass-group" var=biomass />
<@group groupname="catch-group" var=catches />
<@group groupname="fao-stock-status-category-group" var=fao_categories />
<@group groupname="fishing-pressure-group" var=fishing_pressure />
<@group groupname="fishing-pressure-firms-standard-group" var=firms_standard_fishing_pressure />
<@group groupname="landing-group" var=landings />
<@group groupname="scientific-advice-group" var=scientific_advice />
<@group groupname="state-and-trend-group" var=state_and_trend_of_marine_resources />
<#if sdg_flag??>
<@group groupname="grsf-sdg-flag-group" var=sdg_flag?c include=sdg_flag />
</#if>