Menu

#288 AvailabilityTable getEntryByDate does not work properly

v1.0_(example)
closed-fixed
Jon Iles
None
5
2016-02-03
2016-01-28
No

Simple example.
If you have two Availabilities in the List, and pass a date that is bigger than the first item but would be in the second item.

int comparisonResult = range.compareTo(date);
in the first item you get here 1.
because you are more or equal 0 you get into the if. you are not 0 though so result is still null. but you get into the break that intrerupts the for loop and the method returns the result which is null.
The break needs to be in the if comparisonResul==0 check so:
if (comparisonResult == 0)
{
result = entry;
break;
}
Else any value that is bigger than the first item checked will return null.

Discussion

  • Jon Iles

    Jon Iles - 2016-02-03
    • status: open --> closed-fixed
    • assigned_to: Jon Iles
     
  • Jon Iles

    Jon Iles - 2016-02-03

    The code now in git fixes this issue.

     

Log in to post a comment.

MongoDB Logo MongoDB