fix sleeve memory bug

This commit is contained in:
Olivier Gagnon
2021-09-08 23:47:34 -04:00
parent bada8a5f39
commit 2a13db39c7
360 changed files with 5424 additions and 15764 deletions
+4 -14
View File
@@ -23,33 +23,23 @@ export function StockTickerHeaderText(props: IProps): React.ReactElement {
const stock = props.stock;
const stockPriceFormat = numeralWrapper.formatMoney(stock.price);
const spacesAllottedForStockPrice = localesWithLongPriceFormat.includes(
Settings.Locale,
)
? 15
: 12;
const spacesAllottedForStockPrice = localesWithLongPriceFormat.includes(Settings.Locale) ? 15 : 12;
const spacesAfterStockName = " ".repeat(
1 +
TickerHeaderFormatData.longestName -
stock.name.length +
(TickerHeaderFormatData.longestSymbol - stock.symbol.length),
);
const spacesBeforePrice = " ".repeat(
spacesAllottedForStockPrice - stockPriceFormat.length,
);
const spacesBeforePrice = " ".repeat(spacesAllottedForStockPrice - stockPriceFormat.length);
let hdrText = `${stock.name}${spacesAfterStockName}${stock.symbol} -${spacesBeforePrice}${stockPriceFormat}`;
if (props.p.has4SData) {
hdrText += ` - Volatility: ${numeralWrapper.formatPercentage(
stock.mv / 100,
)} - Price Forecast: `;
hdrText += ` - Volatility: ${numeralWrapper.formatPercentage(stock.mv / 100)} - Price Forecast: `;
let plusOrMinus = stock.b; // True for "+", false for "-"
if (stock.otlkMag < 0) {
plusOrMinus = !plusOrMinus;
}
hdrText += (plusOrMinus ? "+" : "-").repeat(
Math.floor(Math.abs(stock.otlkMag) / 10) + 1,
);
hdrText += (plusOrMinus ? "+" : "-").repeat(Math.floor(Math.abs(stock.otlkMag) / 10) + 1);
// Debugging:
// hdrText += ` - ${stock.getAbsoluteForecast()} / ${stock.otlkMagForecast}`;