* fix: orderbook fixed dp - and show rejection reason * fix: show rejection reason in order list * fix: fix parked rejection reason test * fix: remove not covered part
This commit is contained in:
parent
cf43566bde
commit
0fd1739ce5
@ -216,12 +216,14 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
|
||||
it('must see a parked order', () => {
|
||||
// 7002-SORD-048
|
||||
// NOT COVERED: must see an explanation of why parked orders happen
|
||||
updateOrder({
|
||||
id: orderId,
|
||||
status: Schema.OrderStatus.STATUS_PARKED,
|
||||
});
|
||||
cy.getByTestId(`order-status-${orderId}`).should('have.text', 'Parked');
|
||||
cy.getByTestId(`order-status-${orderId}`).should(
|
||||
'have.text',
|
||||
'Parked: Internal error'
|
||||
);
|
||||
});
|
||||
|
||||
it('must see the size of the order and direction/side -', () => {
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
import classNames from 'classnames';
|
||||
|
||||
import {
|
||||
addDecimalsFormatNumber,
|
||||
addDecimalsFixedFormatNumber,
|
||||
t,
|
||||
useResizeObserver,
|
||||
formatNumberFixed,
|
||||
@ -227,25 +227,25 @@ const OrderbookDebugInfo = ({
|
||||
viewportHeight,
|
||||
lockOnMidPrice,
|
||||
priceInCenter: priceInCenter
|
||||
? addDecimalsFormatNumber(priceInCenter, decimalPlaces)
|
||||
? addDecimalsFixedFormatNumber(priceInCenter, decimalPlaces)
|
||||
: '-',
|
||||
maxPriceLevel: addDecimalsFormatNumber(
|
||||
maxPriceLevel: addDecimalsFixedFormatNumber(
|
||||
maxPriceLevel ?? '0',
|
||||
decimalPlaces
|
||||
),
|
||||
bestStaticBidPrice: addDecimalsFormatNumber(
|
||||
bestStaticBidPrice: addDecimalsFixedFormatNumber(
|
||||
bestStaticBidPrice ?? '0',
|
||||
decimalPlaces
|
||||
),
|
||||
bestStaticOfferPrice: addDecimalsFormatNumber(
|
||||
bestStaticOfferPrice: addDecimalsFixedFormatNumber(
|
||||
bestStaticOfferPrice ?? '0',
|
||||
decimalPlaces
|
||||
),
|
||||
minPriceLevel: addDecimalsFormatNumber(
|
||||
minPriceLevel: addDecimalsFixedFormatNumber(
|
||||
minPriceLevel ?? '0',
|
||||
decimalPlaces
|
||||
),
|
||||
midPrice: addDecimalsFormatNumber(
|
||||
midPrice: addDecimalsFixedFormatNumber(
|
||||
(bestStaticOfferPrice &&
|
||||
bestStaticBidPrice &&
|
||||
getPriceLevel(
|
||||
|
@ -84,11 +84,9 @@ const getRejectionReason = (order: OrderEventFieldsFragment): string | null => {
|
||||
Schema.OrderTimeInForceMapping[order.timeInForce]
|
||||
} order was not filled and it has been stopped`
|
||||
);
|
||||
case Schema.OrderStatus.STATUS_REJECTED:
|
||||
default:
|
||||
return order.rejectionReason
|
||||
? t(Schema.OrderRejectionReasonMapping[order.rejectionReason])
|
||||
: null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
@ -249,7 +249,7 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
||||
value,
|
||||
data,
|
||||
}: VegaValueFormatterParams<Order, 'status'>) => {
|
||||
if (value === Schema.OrderStatus.STATUS_REJECTED) {
|
||||
if (data?.rejectionReason && value) {
|
||||
return `${Schema.OrderStatusMapping[value]}: ${
|
||||
data?.rejectionReason &&
|
||||
Schema.OrderRejectionReasonMapping[data.rejectionReason]
|
||||
|
@ -100,6 +100,16 @@ export const addDecimalsFormatNumber = (
|
||||
return formatNumber(x, formatDecimals);
|
||||
};
|
||||
|
||||
export const addDecimalsFixedFormatNumber = (
|
||||
rawValue: string | number,
|
||||
decimalPlaces: number,
|
||||
formatDecimals: number = decimalPlaces
|
||||
) => {
|
||||
const x = addDecimal(rawValue, decimalPlaces);
|
||||
|
||||
return formatNumberFixed(x, formatDecimals);
|
||||
};
|
||||
|
||||
export const formatNumberPercentage = (value: BigNumber, decimals?: number) => {
|
||||
const decimalPlaces =
|
||||
typeof decimals === 'undefined' ? Math.max(value.dp() || 0, 2) : decimals;
|
||||
|
Loading…
Reference in New Issue
Block a user