Fix mass balance error if fertiliser entered after test #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Entering a soil test date that is prior to an actual fertiliser date breaks mass balance because the code was adding all fertiliser events and then doing all soil resets.
The change in this PR combines doing actual fert applications and soil test resets into the same loop so they can be done sequentially.
Important Note. This change causes problems with the testing system because now the crop n uptake is done prior to fertiliser applicaiton which is a problem only for simulations run from the testing environment but makes the test results look bad because they now contain a know error (i.e crop N uptake is insufficient in many cases). I will keep a seperate branch for running tests but the simulation core needs to be refactored so the demands of the testing applicaiton and the schedulling applicaiton can both be met