sort aquired tyes
This commit is contained in:
@@ -5,4 +5,6 @@ export type AcquiredType = Omit<MarbasAcquiredType, 'type'> & {
|
||||
type: MarketType,
|
||||
buy: number,
|
||||
sell: number
|
||||
}
|
||||
}
|
||||
|
||||
export const acquiredTypesToSorted = <T extends {date: Date} = AcquiredType>(array: T[], reverse?: boolean) => array.toSorted((a, b) => reverse ? b.date.getTime() - a.date.getTime() : a.date.getTime() - b.date.getTime())
|
||||
@@ -2,7 +2,7 @@
|
||||
import { Modal } from '@/components';
|
||||
import { MarketType, MarketTypeLabel } from '@/market';
|
||||
import { ref } from 'vue';
|
||||
import { AcquiredType } from './AcquiredType';
|
||||
import { AcquiredType, acquiredTypesToSorted } from './AcquiredType';
|
||||
import { useAcquiredTypesStore } from './acquisition';
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ const open = (t: AcquiredType[]) => {
|
||||
return;
|
||||
}
|
||||
|
||||
types.value = t.toSorted((a, b) => a.date.getTime() - b.date.getTime());
|
||||
types.value = acquiredTypesToSorted(t);
|
||||
type.value = t[0].type;
|
||||
count.value = 1;
|
||||
modalOpen.value = true;
|
||||
|
||||
Reference in New Issue
Block a user