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