Skip to content
Snippets Groups Projects
Commit a04d5f54 authored by Lene Wasskog's avatar Lene Wasskog
Browse files

fix: Do not try to render crop categories for timeseries obs [VIPSUTV-1070]

parent 646a8e33
No related branches found
No related tags found
No related merge requests found
...@@ -93,8 +93,8 @@ ...@@ -93,8 +93,8 @@
}); });
refreshLocationPointOfInterests(<#if observation.locationPointOfInterestId?has_content>${observation.locationPointOfInterestId}<#else>null</#if>); refreshLocationPointOfInterests(<#if observation.locationPointOfInterestId?has_content>${observation.locationPointOfInterestId}<#else>null</#if>);
<#if ! observation.organism?has_content> <#if !observation.organism?has_content>
initCropCategories(); initCropCategories();
</#if> </#if>
// Activating chosen plugin // Activating chosen plugin
$(".chosen-select").chosen(); $(".chosen-select").chosen();
...@@ -341,18 +341,21 @@ ...@@ -341,18 +341,21 @@
} }
function renderCropCategories() { function renderCropCategories() {
var cropCategoryIdList = document.getElementById("cropCategoryIdList"); let cropCategoryIdList = document.getElementById("cropCategoryIdList");
for (var i in cropCategories) { if(!cropCategoryIdList) {
var cropCategory = cropCategories[i]; return;
}
for (let i in cropCategories) {
let cropCategory = cropCategories[i];
// Best effort getting name for crop category // Best effort getting name for crop category
var catName = cropCategory.defaultName; let catName = cropCategory.defaultName;
for (var j in cropCategory.cropCategoryLocalSet) { for (let j in cropCategory.cropCategoryLocalSet) {
var cLocal = cropCategory.cropCategoryLocalSet[j]; let cLocal = cropCategory.cropCategoryLocalSet[j];
if (cLocal.cropCategoryLocalPK.locale == "${currentLocale}") { if (cLocal.cropCategoryLocalPK.locale == "${currentLocale}") {
catName = cLocal.localName; catName = cLocal.localName;
} }
} }
var cOption = new Option(catName, cropCategory.cropCategoryId); let cOption = new Option(catName, cropCategory.cropCategoryId);
cropCategoryIdList.options[cropCategoryIdList.options.length] = cOption; cropCategoryIdList.options[cropCategoryIdList.options.length] = cOption;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment