Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed issue where same image was displayed for all results within the same compute case #329

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ImageResult } from '../ImageResult/ImageResult';
import * as Styled from './VariogramResultTable.styled';

interface ResultObjectType {
variogramResultId: string;
computeCaseId: string;
method: string;
parameter: string;
Expand All @@ -28,6 +29,7 @@ export const VariogramResultTable = ({
const [imageId, setImageId] = useState('');

const caseList = useFetchCases();

const roundResultString = (value: number) => {
if (value) {
return value.toFixed(NumberOfDecimals);
Expand All @@ -52,6 +54,7 @@ export const VariogramResultTable = ({
)[0].modelArea;

const element: ResultObjectType = {
variogramResultId: e.variogramResultId,
computeCaseId: e.computeCaseId,
method: method ? method : '',
parameter: parameter,
Expand All @@ -65,11 +68,13 @@ export const VariogramResultTable = ({
return element;
});

const handleImageDialog = (id: string) => {
const resultRow = resultList.find((e) => e.computeCaseId === id);
const resultFile = resultRow?.variogramResultFiles.find((x) =>
x.fileName.includes('variogram_slices_'),
);
const handleImageDialog = (id: string, variogramResultId: string) => {
const computeCaseResults = resultList.filter((e) => e.computeCaseId === id);
const resultFile = computeCaseResults
.find((r) => r.variogramResultId == variogramResultId)!
.variogramResultFiles.find((x) =>
x.fileName.includes('variogram_slices_'),
);

const imageId = resultFile ? resultFile.variogramResultFileId : '';
setImageId(imageId);
Expand Down Expand Up @@ -116,7 +121,10 @@ export const VariogramResultTable = ({
<div>
<Typography
onClick={() =>
handleImageDialog(row.original.computeCaseId)
handleImageDialog(
row.original.computeCaseId,
row.original.variogramResultId,
)
}
link
>
Expand Down