-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improved handling if not earliest forested value if provided #126
Conversation
validateNotNull(optimalForecastedCarbon, "actual Carbon"); | ||
validateNotNull(savedCarbonPercentage, "saved Carbon"); | ||
evaluateValidations(); | ||
} | ||
|
||
public Carbon calculateReduction() { | ||
if (carbonWithoutOptimization == null) { | ||
return optimalForecastedCarbon; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can optimalForecastedCarbon
be the calculated reduction, if carbonWithoutOptimization
is null
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was an assumption I made. But yes it should be more transparent. We should add it to the docs.
final boolean emissionReduction = earliestForecastedValue.getValue() > optimalValue.getValue(); | ||
return emissionReduction && optimalTime.isInFuture(); | ||
} | ||
|
||
public double calculateSavedCarbonDelta() { | ||
if (earliestForecastedValue == null) { | ||
return 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as previous comment
return earliestForecastedValue.getValue() - optimalValue.getValue(); | ||
} | ||
|
||
public double calculateSavedCarbonPercentage() { | ||
if (earliestForecastedValue == null) { | ||
return 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as previous comment
new Carbon(emissionTimeframe.getOptimalValue().getValue()), | ||
new Percentage(emissionTimeframe.calculateSavedCarbonPercentage()) | ||
); | ||
} | ||
// execution is optimal currently | ||
return new CarbonReduction( | ||
new Delay(false, 0), | ||
new Carbon(emissionTimeframe.getEarliestForecastedValue().getValue()), | ||
new Carbon(emissionTimeframe.getEarliestForecastedValue().getValue()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this a bug?
f0de9c1
to
1def252
Compare
e50c2a5
to
10f3fd4
Compare
No description provided.