Skip to content

Commit e11750b

Browse files
lukicenturikelsos
authored andcommitted
fix: missing asset field in report table
1 parent eb56a7b commit e11750b

File tree

6 files changed

+78
-18
lines changed

6 files changed

+78
-18
lines changed

frontend/app/src/components/history/events/HistoryEventNote.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,18 @@ function isLinkType(t: any): t is keyof ExplorerUrls {
9494

9595
<style lang="scss" module>
9696
.address {
97-
vertical-align: middle;
97+
@apply align-middle;
9898
9999
&__content {
100-
background: var(--v-rotki-light-grey-darken1);
101-
padding-right: 0.25rem;
102-
border-radius: 3rem;
103-
margin: 2px;
100+
@apply bg-rui-grey-300 pr-1 rounded-full m-0.5;
101+
}
102+
}
103+
104+
:global(.dark) {
105+
.address {
106+
&__content {
107+
@apply bg-rui-grey-800;
108+
}
104109
}
105110
}
106111
</style>

frontend/app/src/components/profitloss/ProfitLossEvents.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,28 +218,28 @@ const css = useCssModule();
218218
<template #item.free_amount="{ item }">
219219
<div class="flex items-center justify-between flex-nowrap gap-4">
220220
<AssetLink
221-
v-if="item.asset"
222-
:asset="item.asset"
221+
v-if="item.assetIdentifier"
222+
:asset="item.assetIdentifier"
223223
link
224224
>
225225
<AssetIcon
226226
class="flex"
227-
:identifier="item.asset"
227+
:identifier="item.assetIdentifier"
228228
size="24px"
229229
/>
230230
</AssetLink>
231231
<AmountDisplay
232232
force-currency
233233
:value="item.freeAmount"
234-
:asset="item.asset ? item.asset : ''"
234+
:asset="item.assetIdentifier ? item.assetIdentifier : ''"
235235
/>
236236
</div>
237237
</template>
238238
<template #item.taxable_amount="{ item }">
239239
<AmountDisplay
240240
force-currency
241241
:value="item.taxableAmount"
242-
:asset="item.asset ? item.asset : ''"
242+
:asset="item.assetIdentifier ? item.assetIdentifier : ''"
243243
/>
244244
</template>
245245
<template #item.price="{ item }">
@@ -290,12 +290,14 @@ const css = useCssModule();
290290
:amount="
291291
item.taxableAmount.isZero() ? item.freeAmount : item.taxableAmount
292292
"
293-
:asset="item.asset"
293+
:asset="item.assetIdentifier"
294294
:chain="getChain(item.location)"
295295
/>
296-
<template v-else>
297-
{{ item.notes }}
298-
</template>
296+
<HistoryEventNote
297+
v-else
298+
:notes="item.notes"
299+
:asset="item.assetIdentifier"
300+
/>
299301
</div>
300302
</template>
301303
<template #item.actions="{ item }">

frontend/app/src/components/profitloss/ReportMissingAcquisitions.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ const groupedMissingAcquisitions = computed<MappedGroupedItems[]>(() => {
3737
const endDate = sortedAcquisitions.at(-1)?.time;
3838
assert(endDate, 'end date is missing');
3939
40+
const totalAmountMissing = bigNumberSum(sortedAcquisitions.map(({ missingAmount }) => missingAmount));
41+
4042
return {
4143
asset: key,
4244
startDate,
4345
endDate,
46+
totalAmountMissing,
4447
acquisitions: sortedAcquisitions,
4548
};
4649
});
@@ -72,6 +75,15 @@ const headers = computed<DataTableHeader[]>(() => {
7275
'profit_loss_report.actionable.missing_acquisitions.headers.missing_acquisitions',
7376
).toString(),
7477
value: 'total_missing_acquisition',
78+
align: 'end',
79+
...pinnedClass,
80+
},
81+
{
82+
text: t(
83+
'profit_loss_report.actionable.missing_acquisitions.headers.total_missing',
84+
).toString(),
85+
value: 'total_amount_missing',
86+
align: 'end',
7587
sortable: false,
7688
...pinnedClass,
7789
},
@@ -161,12 +173,17 @@ const isIgnored = (asset: string) => get(isAssetIgnored(asset));
161173
<template #item.total_missing_acquisition="{ item }">
162174
{{ item.acquisitions.length }}
163175
</template>
176+
<template #item.total_amount_missing="{ item }">
177+
<AmountDisplay
178+
class="text-rui-error"
179+
:value="item.totalAmountMissing"
180+
/>
181+
</template>
164182
<template #item.action="{ item }">
165183
<div class="flex flex-col items-center gap-1">
166184
<VMenu offset-y>
167185
<template #activator="{ on }">
168186
<RuiButton
169-
size="sm"
170187
variant="text"
171188
icon
172189
v-on="on"
@@ -243,7 +260,7 @@ const isIgnored = (asset: string) => get(isAssetIgnored(asset));
243260
</template>
244261
<template #item.missingAmount="{ item: childItem }">
245262
<AmountDisplay
246-
pnl
263+
class="text-rui-error"
247264
:value="childItem.missingAmount"
248265
/>
249266
</template>

frontend/app/src/composables/history/events/notes.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ export function useHistoryEventNote() {
158158
return;
159159
}
160160

161+
if (isEvmIdentifier(word)) {
162+
const symbol = get(assetSymbol(word));
163+
if (symbol) {
164+
formats.push({
165+
type: NoteType.WORD,
166+
word: symbol,
167+
});
168+
return;
169+
}
170+
}
171+
161172
formats.push({ type: NoteType.WORD, word });
162173
});
163174

frontend/app/src/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3837,7 +3837,8 @@
38373837
"found_amount": "Found Amount",
38383838
"missing_acquisitions": "Missing Acquisitions",
38393839
"missing_amount": "Missing Amount",
3840-
"quick_action": "Quick Action"
3840+
"quick_action": "Quick Action",
3841+
"total_missing": "Total Amount Missing"
38413842
},
38423843
"hint": "Some asset acquisitions are missing. You will need to figure out where you bought them and either import or manually create the relevant acquisition events",
38433844
"title": "Missing Acquisitions ({total})",

frontend/app/tests/unit/specs/composables/history/notes.spec.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { type NoteFormat, NoteType } from '@/composables/history/events/notes';
33

44
vi.mock('@/composables/assets/retrieval', () => ({
55
useAssetInfoRetrieval: vi.fn().mockReturnValue({
6-
assetSymbol: vi.fn().mockImplementation(identifier => identifier),
6+
assetSymbol: vi.fn().mockImplementation((identifier) => {
7+
if (isEvmIdentifier(identifier))
8+
return 'USDC';
9+
10+
return identifier;
11+
}),
712
}),
813
}));
914

@@ -272,4 +277,23 @@ describe('composables::history/notes', () => {
272277

273278
expect(formatted).toMatchObject(expected);
274279
});
280+
281+
it('with evm asset identifier', () => {
282+
const notes = 'Sell eip155:1/erc20:0x514910771AF9Ca656af840dff83E8264EcF986CA';
283+
284+
const formatted = get(formatNotes({ notes }));
285+
286+
const expected: NoteFormat[] = [
287+
{
288+
type: NoteType.WORD,
289+
word: 'Sell',
290+
},
291+
{
292+
type: NoteType.WORD,
293+
word: 'USDC',
294+
},
295+
];
296+
297+
expect(formatted).toMatchObject(expected);
298+
});
275299
});

0 commit comments

Comments
 (0)