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

Bugfix: Correct date parsing

parent e7a9bffa
No related branches found
No related tags found
No related merge requests found
...@@ -245,12 +245,17 @@ public class LogicService { ...@@ -245,12 +245,17 @@ public class LogicService {
public Response getForecastConfigurationsForOrganization( public Response getForecastConfigurationsForOrganization(
@PathParam("organizationId") Integer organizationId, @PathParam("organizationId") Integer organizationId,
@QueryParam("cropOrganismId") List<Integer> cropOrganismIds, @QueryParam("cropOrganismId") List<Integer> cropOrganismIds,
@QueryParam("from") Date from, @QueryParam("from") String fromStr,
@QueryParam("to") Date to @QueryParam("to") String toStr
) )
{ {
Date from, to;
if(from == null || to == null) SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try{
from = format.parse(fromStr);
to = format.parse(toStr);
}
catch(ParseException | NullPointerException ex)
{ {
to = SystemTime.getSystemTime(); to = SystemTime.getSystemTime();
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
...@@ -258,6 +263,7 @@ public class LogicService { ...@@ -258,6 +263,7 @@ public class LogicService {
cal.add(Calendar.MONTH, -4); cal.add(Calendar.MONTH, -4);
from = cal.getTime(); from = cal.getTime();
} }
// First: Get all users for organization // First: Get all users for organization
List<VipsLogicUser> organizationUsers = SessionControllerGetter.getUserBean().getUsersByOrganization(organizationId); List<VipsLogicUser> organizationUsers = SessionControllerGetter.getUserBean().getUsersByOrganization(organizationId);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment