Skip to content
Snippets Groups Projects
Commit e5d5b566 authored by Alejandro De Maria Antolinos's avatar Alejandro De Maria Antolinos
Browse files

Merge branch '830-snapshot-not-found-on-bm29' into 'main'

Resolve "Snapshot not found on BM29"

Closes #830

See merge request !725
parents f554e861 723472be
No related branches found
Tags 1.44.0
1 merge request!725Resolve "Snapshot not found on BM29"
Pipeline #226821 passed
...@@ -4,6 +4,7 @@ import { ...@@ -4,6 +4,7 @@ import {
SnashoptConfigItem, SnashoptConfigItem,
getDatasetName, getDatasetName,
getDatasetParamValue, getDatasetParamValue,
getParameterByName,
isProcessed, isProcessed,
} from '@edata-portal/core'; } from '@edata-portal/core';
import type { Dataset } from '@edata-portal/icat-plus-api'; import type { Dataset } from '@edata-portal/icat-plus-api';
...@@ -12,14 +13,28 @@ const isBuffer = (dataset: Dataset) => { ...@@ -12,14 +13,28 @@ const isBuffer = (dataset: Dataset) => {
return getDatasetParamValue(dataset, 'SAXS_sample_type') === 'buffer'; return getDatasetParamValue(dataset, 'SAXS_sample_type') === 'buffer';
}; };
const isIntegration = (dataset: Dataset): boolean => { const checkScanType = (
return getDatasetName(dataset).indexOf('integrate') !== -1; dataset: Dataset,
}; scanType: string,
keyword: string,
): boolean => {
// Retrieve the scanType parameter from the dataset
const parameter = getParameterByName('scanType', dataset.parameters);
const isSubtraction = (dataset: Dataset): boolean => { // Return true if scanType exists and matches the provided type
return getDatasetName(dataset).indexOf('subtract') !== -1; if (parameter?.value === scanType) {
return true;
}
// Check if the dataset name contains the specified keyword
return getDatasetName(dataset).includes(keyword);
}; };
const isIntegration = (dataset: Dataset): boolean =>
checkScanType(dataset, 'integration', 'integrate');
const isSubtraction = (dataset: Dataset): boolean =>
checkScanType(dataset, 'subtraction', 'subtract');
function sampleParameters() { function sampleParameters() {
return [ return [
{ {
...@@ -144,7 +159,7 @@ export function getSnapshotConfigByProcesssedDataset( ...@@ -144,7 +159,7 @@ export function getSnapshotConfigByProcesssedDataset(
processedDataset: Dataset, processedDataset: Dataset,
): SnashoptConfigItem[] { ): SnashoptConfigItem[] {
/** if subtractiong */ /** if subtractiong */
if (processedDataset.name.indexOf('subtract') !== -1) { if (isSubtraction(processedDataset)) {
return [ return [
{ {
type: 'metadata', type: 'metadata',
...@@ -196,7 +211,7 @@ export function getSnapshotConfigByProcesssedDataset( ...@@ -196,7 +211,7 @@ export function getSnapshotConfigByProcesssedDataset(
]; ];
} }
if (processedDataset.name.indexOf('integrate') !== -1) { if (isIntegration(processedDataset)) {
return [ return [
{ {
type: 'metadata', type: 'metadata',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment