Fixed OnMedicationCalculation throwing an exception if the last consultation encounter wasn't part of a visit