Fix botcomparison summary rendering

This commit is contained in:
Matthias 2022-05-09 07:10:34 +02:00
parent 2705c62c20
commit 51834337f2
4 changed files with 21 additions and 4 deletions

View File

@ -81,9 +81,9 @@ export default defineComponent({
botId: undefined,
botName: 'Summary',
profitClosed: 0,
profitClosedRatio: 0,
profitClosedRatio: undefined,
profitOpen: 0,
profitOpenRatio: 0,
profitOpenRatio: undefined,
stakeCurrency: 'USDT',
wins: 0,
losses: 0,

View File

@ -47,4 +47,19 @@ describe('ProfitPill.vue', () => {
cy.get('div').should('contain', '(0)');
cy.get('span').should('have.attr', 'title', 'BTC');
});
it('Shows a pill without relative profits.', async () => {
mount(ProfitPill, {
propsData: {
profitRatio: undefined,
profitAbs: 223,
profitDesc: '',
stakeCurrency: 'USDT',
},
});
cy.get('div').should('have.class', 'profit-pill').should('be.visible');
// cy.get('div').should('not.contain', '%');
cy.get('div').should('contain', '223');
cy.get('span').should('have.attr', 'title', 'USDT');
});
});

View File

@ -46,6 +46,8 @@ export default defineComponent({
const profitString = computed((): string => {
if (props.profitRatio !== undefined && props.profitAbs !== undefined) {
return `(${formatPrice(props.profitAbs, 3)})`;
} else if (props.profitAbs !== undefined) {
return `${formatPrice(props.profitAbs, 3)}`;
}
return '';
});

View File

@ -3,9 +3,9 @@ export interface ComparisonTableItems {
botName: string;
trades?: string;
profitClosed: number;
profitClosedRatio: number;
profitClosedRatio?: number;
profitOpen: number;
profitOpenRatio: number;
profitOpenRatio?: number;
stakeCurrency: string;
wins: number;
losses: number;