Fabio Sinibaldi 2018-07-19 16:42:54 +00:00
parent fc2fb78a66
commit ec02210e55
1 changed files with 7 additions and 7 deletions

View File

@ -67,12 +67,12 @@ public class AccountingDaoImpl implements AccountingDao{
if(fromDate.isAfter(toDate)) throw new ParameterException("Irregular time interval: \"From\" parameter cannot be after \"To\" parameter."); if(fromDate.isAfter(toDate)) throw new ParameterException("Irregular time interval: \"From\" parameter cannot be after \"To\" parameter.");
int timeSlices=getRangeSize(fromDate, toDate, resolution); int timeSlices=getRangeSize(fromDate, toDate, resolution);
if(timeSlices==0) { // if(timeSlices==0) {
log.debug("Time slices is {}. Going to increment \"To\" parameter.",timeSlices); // log.debug("Time slices is {}. Going to increment \"To\" parameter.",timeSlices);
toDate=increment(toDate,resolution,1); // toDate=increment(toDate,resolution,1);
timeSlices=getRangeSize(fromDate, toDate, resolution); // timeSlices=getRangeSize(fromDate, toDate, resolution);
if(timeSlices==0) throw new RuntimeException("Unexpected Exception"); // if(timeSlices==0) throw new RuntimeException("Unexpected Exception");
} // }
Connection conn=connectionManager.getConnection(); Connection conn=connectionManager.getConnection();
@ -245,7 +245,7 @@ public class AccountingDaoImpl implements AccountingDao{
Period p=Period.between(from.toLocalDate(), to.toLocalDate()); Period p=Period.between(from.toLocalDate(), to.toLocalDate());
switch(resolution) { switch(resolution) {
case MONTHLY : return p.getMonths()+(p.getYears()*12); case MONTHLY : return p.getMonths()+(p.getYears()*12)+1; // +1 to include upper bound
default : throw new ParameterException("Invalid resolution "+resolution); default : throw new ParameterException("Invalid resolution "+resolution);
} }