Skip to content

Commit

Permalink
refactor: changed case result structure and routing
Browse files Browse the repository at this point in the history
  • Loading branch information
mheggelund committed Nov 1, 2023
1 parent 45c8084 commit 23cbc24
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 68 deletions.

This file was deleted.

17 changes: 0 additions & 17 deletions src/features/Results/CaseResult/CaseResultCard/CaseResultCard.tsx

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions src/features/Results/CaseResult/CaseResultList/CaseResultList.tsx

This file was deleted.

109 changes: 104 additions & 5 deletions src/pages/ModelPages/Results/Results.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,120 @@
import { CaseResultList } from '../../../features/Results/CaseResult/CaseResultList/CaseResultList';
/* eslint-disable max-lines-per-function */
import { CaseResultView } from '../../../features/Results/CaseResult/CaseResultView/CaseResultView';
import { NoResults } from '../../../features/Results/NoResults/NoResults';

export interface VariogramResultListType {
caseId: number;
title: string;
resultList: VariogramResultType[];
}

export interface VariogramResultType {
identifier: number;
family: string;
computeMethod: string;
modelArea: string;
attribute: string;
quality: GLfloat;
sigma: GLfloat;
approved: string;
}

export interface ObjectResultType {
identifier: number;
family: string;
CWMean: GLfloat;
CHMean: GLfloat;
CWSD: GLfloat;
CHSD: GLfloat;
CWCount: GLfloat;
CHCount: GLfloat;
approved: string;
}

export type ResultType = {
caseId: string;
case: string;
finished: boolean;
};
export const Results = () => {
const loaded = true;
const results: ResultType[] = [
{ caseId: '1', case: 'Variogramcase 1', finished: true },
{ caseId: '2', case: 'Variogramcase 2', finished: false },
const caseList: VariogramResultListType[] = [
{
caseId: 1,
title: 'Variogram Case 1',
resultList: [
{
identifier: 0,
family: 'exponential',
computeMethod: 'Net-to-gross',
modelArea: 'Left',
attribute: 'Porosity',
quality: 0.6427819811789964,
sigma: 0.06967589201242001,
approved: 'rejected',
},
{
identifier: 1,
family: 'gaussian',
computeMethod: 'Net-to-gross',
modelArea: 'Proximal',
attribute: 'Porosity',
quality: 0.5432924009373808,
sigma: 0.0670758033212357,
approved: 'pending',
},
],
},
{
caseId: 3,
title: 'Variogram Case 3',
resultList: [
{
identifier: 2,
family: 'general_exponential',
computeMethod: 'Indicator / Architectural Element (AE)',
modelArea: 'Distal',
attribute: 'Porosity',
quality: 0.5580294305723851,
sigma: 0.0678988627745677,
approved: 'approved',
},
],
},
];

const objectList: ObjectResultType[] = [
{
identifier: 3,
family: 'channel',
CWMean: 190.15,
CHMean: 1.94,
CWSD: 68.69,
CHSD: 0.68,
CWCount: 863,
CHCount: 863,
approved: 'approved',
},
{
identifier: 4,
family: 'channel',
CWMean: 134.47,
CHMean: 1.76,
CWSD: 59.93,
CHSD: 0.73,
CWCount: 754,
CHCount: 754,
approved: 'approved',
},
];

return (
<>
{loaded && results ? <CaseResultList results={results} /> : <NoResults />}
{loaded && (caseList.length !== 0 || objectList.length !== 0) ? (
<CaseResultView caseList={caseList} objectList={objectList} />
) : (
<NoResults />
)}
</>
);
};
2 changes: 0 additions & 2 deletions src/router.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createBrowserRouter, NonIndexRouteObject } from 'react-router-dom';
import { App } from './App';
import { ModelView } from './features/ModelView/ModelView';
import { CaseResultView } from './features/Results/CaseResult/CaseResultView/CaseResultView';
import { About } from './pages/About/About';
import { Api } from './pages/Api/Api';
import { Browse } from './pages/Browse/Browse';
Expand Down Expand Up @@ -47,7 +46,6 @@ const appRoutes = (tabs as NonIndexRouteObject[]).concat([
path: 'results',
element: <Results />,
},
{ path: 'results/:caseId', element: <CaseResultView /> },
],
},
]);
Expand Down

0 comments on commit 23cbc24

Please sign in to comment.