Skip to content

Commit

Permalink
chore: Update Object result compute type. (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
mheggelund authored Jun 21, 2024
1 parent b59be59 commit 76c5c76
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
17 changes: 3 additions & 14 deletions src/features/Results/CaseResult/CaseResultView/CaseResultView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,16 @@ export const CaseResultView = ({
channelResultList,
variogramResultList,
computeCases,
type,
}: {
channelResultList?: GetObjectResultsDto[];
variogramResultList?: GetVariogramResultsDto[];
computeCases?: ComputeCaseDto[];
type: string;
}) => {
const channelType =
channelResultList !== undefined && channelResultList[0].type
? channelResultList[0].type
: '';
const variogramType = variogramResultList !== undefined ? 'Variogram' : '';

return (
<Styled.CaseResultView>
<Typography variant="h2">
{channelType !== ''
? channelType
: variogramType !== ''
? variogramType
: ''}{' '}
results
</Typography>
<Typography variant="h2">{type} results</Typography>
<Styled.CaseResultList>
{variogramResultList && (
<VariogramResultTable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export const ChannelResult = ({
modelArea={modelArea}
data={data}
></ResultArea>
<ChannelResultTable data={data}></ChannelResultTable>
<ChannelResultTable
data={data}
computeMethod={computeMethod}
></ChannelResultTable>
</Styled.InnerWrapper>
</Styled.Wrapper>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
/* eslint-disable max-lines-per-function */
import { Table } from '@equinor/eds-core-react';

import * as Styled from './ChannelResultTable.styled';
import { GetObjectResultsDto } from '../../../../../../api/generated/models/GetObjectResultsDto';
import * as Styled from './ChannelResultTable.styled';

const NumberOfDecimals = 2;

export const ChannelResultTable = ({ data }: { data: GetObjectResultsDto }) => {
export const ChannelResultTable = ({
data,
computeMethod,
}: {
data: GetObjectResultsDto;
computeMethod?: string;
}) => {
const roundResultString = (value?: number) => {
if (value) {
return value.toFixed(NumberOfDecimals);
Expand All @@ -25,15 +31,15 @@ export const ChannelResultTable = ({ data }: { data: GetObjectResultsDto }) => {
</Table.Head>
<Table.Body key={data.computeCaseId}>
<Table.Row>
<Styled.ColumnCell>Channel width</Styled.ColumnCell>
<Styled.ColumnCell>{computeMethod} width</Styled.ColumnCell>
<Styled.DataCell>
{roundResultString(data.width?.mean)}
</Styled.DataCell>
<Styled.DataCell>{roundResultString(data.width?.sd)}</Styled.DataCell>
<Styled.DataCell>{data.width?.count}</Styled.DataCell>
</Table.Row>
<Table.Row>
<Styled.ColumnCell>Channel height</Styled.ColumnCell>
<Styled.ColumnCell>{computeMethod} height</Styled.ColumnCell>
<Styled.DataCell>
{roundResultString(data.height?.mean)}
</Styled.DataCell>
Expand Down
1 change: 1 addition & 0 deletions src/pages/ModelPages/Results/ObjectResult/ObjectResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const ObjectResult = () => {
<CaseResultView
channelResultList={objectResults}
computeCases={cases.data?.data}
type="Object"
/>
) : (
<NoResults />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const VariogramResults = () => {
<CaseResultView
variogramResultList={variogramResults}
computeCases={cases.data?.data}
type="Variogram"
/>
) : (
<NoResults />
Expand Down

0 comments on commit 76c5c76

Please sign in to comment.