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.
The code included does two things:
So, say the array had 10 minutes of data from a field that was 100% in use. But then all belts filled after 10 minutes and it went idle for 10 minutes. The code would say "10 minutes passed between the oldest snapshot of the field and the most recent change." and it would also realize 10 minutes had passed between the last snapshot and right now. It would thus compute the average ore rate for the 10 minute the field was running (say 3000 ore/min) and then decrease that by the factor of idle time (10m of data, 10m of idle = 50% decrease to mining rate). So it would report 1500 ore/min as the result to be displayed.
I have lots of comments in the code explaining how and why things are done. I need to test it more on my end to ensure there are no more weird bugs. But for now, I can add a field, remove a field, and just have fields mine all without issue. The one 'weird bit' is that until a field has been mining for at least 20 seconds (with default settings) it will not display a correct mining rate. This is because I need at least two snapshots to calculate a mining rate, and we only check for changes every 10 seconds (at least on my map).