diff --git a/src/main/java/no/nibio/vips/logic/entity/OrganismExternalResource.java b/src/main/java/no/nibio/vips/logic/entity/OrganismExternalResource.java index 24c191b4f03d324c06e5088353508499e7e87ba4..d88fe971fb916bacf330d573e82ab3093548bb17 100755 --- a/src/main/java/no/nibio/vips/logic/entity/OrganismExternalResource.java +++ b/src/main/java/no/nibio/vips/logic/entity/OrganismExternalResource.java @@ -19,6 +19,7 @@ package no.nibio.vips.logic.entity; +import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.EmbeddedId; @@ -54,6 +55,7 @@ public class OrganismExternalResource implements Serializable { private String resourceIdentifier; @JoinColumn(name = "organism_id", referencedColumnName = "organism_id", insertable = false, updatable = false) @ManyToOne(optional = false) + @JsonIgnore private Organism organism; @JoinColumn(name = "external_resource_id", referencedColumnName = "external_resource_id", insertable = false, updatable = false) @ManyToOne(optional = false) diff --git a/src/main/webapp/js/observationMap.js b/src/main/webapp/js/observationMap.js index c704064f147eaea95e5c7bbabdc8faa2bcec8b97..5a132bb72d90eb3e13bb0b931cd21ec23d500426 100755 --- a/src/main/webapp/js/observationMap.js +++ b/src/main/webapp/js/observationMap.js @@ -415,5 +415,5 @@ var getObservationRelativeAge = function(feature) console.info("No obs with id=" + feature.get("observationId")); return null; // Means invisible } - return Math.floor((currentDateInMillis - observation.timeOfObservation) / (1000 * 60 * 60 * 24)) + 1; + return Math.floor((currentDateInMillis - getUnixTimestampFromJSON(observation.timeOfObservation)) / (1000 * 60 * 60 * 24)) + 1; }; \ No newline at end of file diff --git a/src/main/webapp/js/util.js b/src/main/webapp/js/util.js index 8e485f921cf0b0d702cc479e382826452885b122..382314a03733ac00c4f2db4f687366bccd530939 100755 --- a/src/main/webapp/js/util.js +++ b/src/main/webapp/js/util.js @@ -146,3 +146,20 @@ function getLocalizedCropCategoryName(cropCategory) return "Unnamed"; } +/** Ensure that we're able to handle both a unix timestamp and an ISO timestamp + * + * @param {type} ambiguousValue + * @returns {Number} + */ +function getUnixTimestampFromJSON(ambiguousValue) +{ + var possibleDateObject = new Date(ambiguousValue); + if(possibleDateObject.getTime() === NaN && typeof parseInt(ambiguousValue) === "number") + { + return parseInt(ambiguousValue); + } + else + { + return possibleDateObject.getTime(); + } +} \ No newline at end of file