Bug fix: sometimes patient cases let you add more appointments than the "allowed" amount

On very rare occasions, it was found that despite a patient case having a maximum limit of appointments (such as 5), an additional appointment could be added to the case (making the total “6 out of 5”, for example). That definitely wasn’t correct, so we have fixed it up!