@@ -105,7 +105,7 @@ const BreakdownCard: React.FC<BreakdownCardProp> = ({ title, breakdown, borderCo
105105} ;
106106
107107function DetailedBreakdown ( ) {
108- const { currentServer, newServer, comparison, intersect, workload, singleComparison, oldPerformanceIndicator, newPerformanceIndicator, capexBreakdown, opexBreakdown, oldPowerConsumption, newPowerConsumption } = useBenchmarkContext ( ) ;
108+ const { currentServer, newServer, comparison, intersect, workload, singleComparison, oldPerformanceIndicator, newPerformanceIndicator, scaling , capexBreakdown, opexBreakdown, oldPowerConsumption, newPowerConsumption } = useBenchmarkContext ( ) ;
109109
110110 const year = intersect ? yearToYearAndMonth ( Number ( intersect . x . toFixed ( 1 ) ) , false , true ) : "No Break-Even" ;
111111 const total = intersect ? addCommaToNumber ( Number ( intersect . y . toFixed ( 1 ) ) ) + " kgCO₂" : "No Break-even" ;
@@ -116,15 +116,21 @@ function DetailedBreakdown() {
116116 const titleText = singleComparison ? 'Current' : 'New'
117117
118118 let perfRatio :any = ( newPerformanceIndicator / oldPerformanceIndicator )
119- let consumptionRatio :any = ( newPowerConsumption / oldPowerConsumption )
119+ let normalizedOldPowerConsumption = oldPowerConsumption ;
120+
121+ if ( scaling === 'Emissions' ) {
122+ normalizedOldPowerConsumption = oldPowerConsumption * perfRatio ;
123+ }
124+
125+ let consumptionRatio :any = ( newPowerConsumption / normalizedOldPowerConsumption )
120126
121127 const ratioDecimalPlaces = withinXPercent ( perfRatio , consumptionRatio , 0.1 ) ? 3 : 1 ;
122128 perfRatio = perfRatio . toFixed ( ratioDecimalPlaces ) . replace ( / \. 0 0 0 $ / , '' ) ;
123129 consumptionRatio = consumptionRatio . toFixed ( ratioDecimalPlaces ) . replace ( / \. 0 0 0 $ / , '' ) ;
124130
125131 let oldPerfFormatted = oldPerformanceIndicator . toFixed ( 1 ) . replace ( / \. 0 $ / , '' ) ;
126132 let newPerfFormatted = newPerformanceIndicator . toFixed ( 1 ) . replace ( / \. 0 $ / , '' ) ;
127- let oldConsumptionFormatted = oldPowerConsumption . toFixed ( 3 ) . replace ( / \. 0 $ / , '' ) ;
133+ let oldConsumptionFormatted = normalizedOldPowerConsumption . toFixed ( 3 ) . replace ( / \. 0 $ / , '' ) ;
128134 let newConsumptionFormatted = newPowerConsumption . toFixed ( 3 ) . replace ( / \. 0 $ / , '' ) ;
129135
130136 newPerfFormatted = addCommaToNumber ( Number ( newPerfFormatted ) ) ;
0 commit comments