Skip to content

Commit a0e58cc

Browse files
authored
fix: error exporting datasets with 'unspecified' organism_type in anvil explorer (#4579) (#4580)
* fix: error exporting datasets with 'unspecified' organsm_type in anvil explorer (#4579) * fix: jsdoc comment (#4579) ---------
1 parent 02f1cc7 commit a0e58cc

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,20 +1272,27 @@ export function getExportSelectedDataSummary(
12721272
function getExportTerraEntityFilters(
12731273
datasetsResponse: DatasetsResponse
12741274
): Filters {
1275-
return [
1276-
...getExportEntityFilters(datasetsResponse),
1277-
{
1278-
categoryKey: ANVIL_CMG_CATEGORY_KEY.DONOR_ORGANISM_TYPE,
1279-
value: processRawEntityArrayValue(
1280-
datasetsResponse.donors,
1281-
"organism_type"
1282-
),
1283-
},
1284-
{
1285-
categoryKey: ANVIL_CMG_CATEGORY_KEY.FILE_FILE_FORMAT,
1286-
value: processRawEntityArrayValue(datasetsResponse.files, "file_format"),
1287-
},
1288-
];
1275+
const filters: Filters = [];
1276+
1277+
filters.push(...getExportEntityFilters(datasetsResponse));
1278+
1279+
// Add donor organism type filter (add `[null]` if no values are available).
1280+
const donorOrganismType = processRawEntityArrayValue(
1281+
datasetsResponse.donors,
1282+
"organism_type"
1283+
);
1284+
filters.push({
1285+
categoryKey: ANVIL_CMG_CATEGORY_KEY.DONOR_ORGANISM_TYPE,
1286+
value: donorOrganismType.length > 0 ? donorOrganismType : [null],
1287+
});
1288+
1289+
// Add file format filter.
1290+
filters.push({
1291+
categoryKey: ANVIL_CMG_CATEGORY_KEY.FILE_FILE_FORMAT,
1292+
value: processRawEntityArrayValue(datasetsResponse.files, "file_format"),
1293+
});
1294+
1295+
return filters;
12891296
}
12901297

12911298
/**

0 commit comments

Comments
 (0)