Skip to content
Snippets Groups Projects
Commit 504392a4 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Change status color before first observation

parent 52242437
No related branches found
No related tags found
No related merge requests found
...@@ -84,22 +84,29 @@ public class DeliaRadicumFloralisObservationModel extends I18nImpl implements Mo ...@@ -84,22 +84,29 @@ public class DeliaRadicumFloralisObservationModel extends I18nImpl implements Mo
DecimalFormat dFormat = new DecimalFormat("###.##"); DecimalFormat dFormat = new DecimalFormat("###.##");
Date currentDate = startDateGrowth; Date currentDate = startDateGrowth;
boolean firstValidObservationFound = false;
while(currentDate.compareTo(endDateCalculation) <= 0) while(currentDate.compareTo(endDateCalculation) <= 0)
{ {
Result result = new ResultImpl(); Result result = new ResultImpl();
result.setResultValidTime(currentDate); result.setResultValidTime(currentDate);
Observation latestObs = getObservationValidForDate(currentDate); Observation latestObs = getObservationValidForDate(currentDate);
if(latestObs == null) if(latestObs == null && ! firstValidObservationFound)
{
result.setWarningStatus(Result.WARNING_STATUS_NO_WARNING);
}
else if(latestObs == null)
{ {
result.setWarningStatus(Result.WARNING_STATUS_NO_WARNING_MISSING_DATA); result.setWarningStatus(Result.WARNING_STATUS_NO_WARNING_MISSING_DATA);
} }
else if(this.getPestObservationValue(latestObs.getObservationData()) >= this.getEconomicThreshold(currentDate)) else if(this.getPestObservationValue(latestObs.getObservationData()) >= this.getEconomicThreshold(currentDate))
{ {
firstValidObservationFound = true;
result.setWarningStatus(Result.WARNING_STATUS_HIGH_RISK); result.setWarningStatus(Result.WARNING_STATUS_HIGH_RISK);
} }
else else
{ {
firstValidObservationFound = true;
result.setWarningStatus(Result.WARNING_STATUS_NO_RISK); result.setWarningStatus(Result.WARNING_STATUS_NO_RISK);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment