From e29e3f66d29a4100c8fc060225d57263884bfa7d Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Tue, 13 Mar 2018 16:13:27 +0100 Subject: [PATCH] Handling NULL weather station info in forecast configuration --- forecasts/models.py | 13 +++++++++---- forecasts/static/forecasts/js/forecasts.js | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/forecasts/models.py b/forecasts/models.py index a6a55e54..1e5f71d0 100755 --- a/forecasts/models.py +++ b/forecasts/models.py @@ -229,6 +229,15 @@ class ForecastConfiguration: for crop_organism_id in crop_organism_ids: crop_organism_id_paramstring += "&cropOrganismId=%s" % crop_organism_id + print "%s://%s/rest/organizationforecastconfigurations/%s?from=%s-01-01&to=%s-12-31%s" % ( + settings.VIPSLOGIC_PROTOCOL, + settings.VIPSLOGIC_SERVER_NAME, + settings.VIPS_ORGANIZATION_ID, + season, + season, + crop_organism_id_paramstring + ) + request_result = requests.get("%s://%s/rest/organizationforecastconfigurations/%s?from=%s-01-01&to=%s-12-31%s" % ( settings.VIPSLOGIC_PROTOCOL, settings.VIPSLOGIC_SERVER_NAME, @@ -527,7 +536,3 @@ class ModelGraphParameter(models.Model): def __unicode__(self): return self.model_id + "/" + self.resultparameter.getNamespaceKey() - - - - diff --git a/forecasts/static/forecasts/js/forecasts.js b/forecasts/static/forecasts/js/forecasts.js index 8fa517a1..7853faa1 100755 --- a/forecasts/static/forecasts/js/forecasts.js +++ b/forecasts/static/forecasts/js/forecasts.js @@ -45,8 +45,8 @@ Organism.prototype.getLocalName = function(languageCode) var PointOfInterest = function(pJSON) { - this.pointOfInterestId = pJSON.pointOfInterestId; - this.name = pJSON.name; + this.pointOfInterestId = pJSON != null ? pJSON.pointOfInterestId : -1; + this.name = pJSON != null ? pJSON.name : ""; }; // Defining the forecast configuration object -- GitLab