The instruction prompt for this exercise clearly states that months are defined as 22 billable days, and that discounts are only applied when the contractor can bill for an entire month at a time. We are also told this module will have us work on two concepts, namely floating point and integer operations.
I believe that, as presented, the accepted solutions for the tests on FreelancerRates.days_in_budget are not right. You’re effectively asking us to steal from our contractor client by giving inappropriate discounts to the project manager.
The final test wants us to assert FreelancerRates.days_in_budget(480, 60, 20) == 1.2, discounting in a situation where the project manager can only afford a single workday and no discount should be applied. We’re making our client, the contractor, give away $96 of free labor in violation of the rules we were asked to follow.
The way I interpreted what was presented to us, I thought the correct approach was to integer divide the budget by the monthly discounted rate to find how many discounted months would fit in the budget, then take any remaining budget and see how many days that would cover, combining and rounding the two to come to a final result. My solution would return 1.0 where the final test is expecting a 1.2
The problem statement mentions that the freelancer offers a discount for monthly billing, but not that the freelancer will only give a discount for monthly billing or that the discount can only be applied in 22 day chunks.
@hTwo Thanks for opening the issue. I understand that you are frustrated. However, please moderate your tone to be more respectful of those who create and maintain exercises that you’re getting for free. 94% of people who start the exercise finish it, so while I don’t disagree that it could be clearer, it’s also not providing some sort of logical impossibility.
@Georgy5 Thanks for your suggestion. I’ve opened a PR here. Does that make things clearer?
It’s funny because I had the same confusion when I first made that exercise in one of the tracks. But just a few minutes ago, I finished this exercise in the Elixir track without remembering or looking up how I did it in other tracks, and for some reason, this confusion didn’t come up this time. So I totally get why this can be confusing - I myself interpreted it 2 different ways at 2 different times
I think the PR @iHiD made clarifies the issue, without making the instructions overly verbose.