[poincare/unit] Remove some additional results

Imperial additional results now only appear when the selected unit
system is Imperial.

Change-Id: Icc314d0148810bea67e4d729179393f1fceaf214
This commit is contained in:
Gabriel Ozouf
2020-08-12 17:15:14 +02:00
committed by Émilie Feral
parent 801c61549c
commit 860ce558c2
4 changed files with 74 additions and 34 deletions

View File

@@ -257,10 +257,10 @@ Calculation::AdditionalInformationType Calculation::additionalInformationType(Co
/* FIXME : When this method is accessed via leaving the additional outputs,
* ie via a press on BACK, the reduction is interrupted, and removeUnit
* goes badly.*/
PoincareHelpers::Reduce(&o, App::app()->localContext(), ExpressionNode::ReductionTarget::User, ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithDefinitionsOrUndefined);
PoincareHelpers::Reduce(&o, App::app()->localContext(), ExpressionNode::ReductionTarget::User, ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithDefinitionsOrUndefined, ExpressionNode::UnitConversion::None);
o = o.removeUnit(&unit);
double value = PoincareHelpers::ApproximateToScalar<double>(o, App::app()->localContext());
return (Unit::ShouldDisplayAdditionalOutputs(value, unit)) ? AdditionalInformationType::Unit : AdditionalInformationType::None;
return (Unit::ShouldDisplayAdditionalOutputs(value, unit, GlobalPreferences::sharedGlobalPreferences()->unitFormat())) ? AdditionalInformationType::Unit : AdditionalInformationType::None;
}
if (o.isBasedIntegerCappedBy(k_maximalIntegerWithAdditionalInformation)) {
return AdditionalInformationType::Integer;