fix potential issue with grouping
This commit is contained in:
@@ -66,9 +66,9 @@ const filteredItems = props.items.filter(r => r.type.name.toLowerCase().includes
|
||||
}
|
||||
|
||||
const list: Result[] = [];
|
||||
const groups = Map.groupBy(filteredItems, r => r.type);
|
||||
const groups = Map.groupBy(filteredItems, r => r.type.id);
|
||||
|
||||
groups.forEach((group, type) => {
|
||||
groups.forEach((group, typeID) => {
|
||||
const oldest = group.reduce((acc: AcquiredType | undefined, r: AcquiredType) => (acc && acc.date < r.date) ? acc : r, undefined);
|
||||
|
||||
if (!oldest) {
|
||||
@@ -82,8 +82,8 @@ const filteredItems = props.items.filter(r => r.type.name.toLowerCase().includes
|
||||
|
||||
list.push({
|
||||
type: oldest,
|
||||
typeID: type.id,
|
||||
name: type.name,
|
||||
typeID,
|
||||
name: oldest.type.name,
|
||||
buy: oldest.buy,
|
||||
sell: oldest.sell,
|
||||
price: price,
|
||||
|
||||
Reference in New Issue
Block a user