bugfixing

This commit is contained in:
MuslemRahimi 2024-12-10 18:23:58 +01:00
parent 0900796a61
commit e5435ebd9a

View File

@ -198,8 +198,10 @@ export const calculateChange = (oldList?: any[], newList?: any[]) => {
if (!oldList?.length || !newList?.length) return [...(oldList || [])];
const newListMap = new Map(newList.map((item) => [item.symbol, item]));
const updatedList = [];
const updatedList = oldList.map((item) => {
for (let i = 0; i < oldList.length; i++) {
const item = oldList[i];
const newItem = newListMap.get(item.symbol);
if (newItem?.avgPrice) {
@ -215,13 +217,14 @@ export const calculateChange = (oldList?: any[], newList?: any[]) => {
item.price = newPrice;
}
return item;
});
updatedList.push(item);
}
return updatedList;
};
export function updateStockList(stockList, originalData) {
// Create a Map for O(1) lookup of original data by symbol
const originalDataMap = new Map(