File tree Expand file tree Collapse file tree 2 files changed +32
-7
lines changed
packages/openneuro-app/src/scripts/pages/front-page/aggregate-queries Expand file tree Collapse file tree 2 files changed +32
-7
lines changed Original file line number Diff line number Diff line change @@ -29,13 +29,16 @@ const AggregateCountsContainer: React.FC<AggregateCountsContainerProps> = ({
2929 else {
3030 return (
3131 < >
32- < AggregateCount
33- type = "participants"
34- count = { participantData . participantCount }
35- />
32+ { participantData . participantCount > 0 && (
33+ < AggregateCount
34+ type = "participants"
35+ count = { participantData . participantCount }
36+ />
37+ ) }
3638 < AggregateCount
3739 type = "publicDataset"
38- count = { publicDatasetsData . datasets ?. pageInfo ?. count || 0 }
40+ count = { publicDatasetsData . datasets ?. pageInfo ?. count ||
41+ publicDatasetsData . advancedSearch ?. pageInfo . count || 0 }
3942 />
4043 </ >
4144 )
Original file line number Diff line number Diff line change @@ -10,9 +10,31 @@ const PUBLIC_DATASETS_COUNT = gql`
1010 }
1111`
1212
13+ const BRAIN_INITIATIVE_COUNT = gql `
14+ query AdvancedSearch($query: JSON!, $datasetType: String!) {
15+ advancedSearch(query: $query, datasetType: $datasetType) {
16+ pageInfo {
17+ count
18+ }
19+ }
20+ }
21+ `
22+
1323const usePublicDatasetsCount = ( modality ?: string ) => {
14- return useQuery ( PUBLIC_DATASETS_COUNT , {
15- variables : { modality } ,
24+ const isNIH = modality === "NIH"
25+
26+ const query = isNIH ? BRAIN_INITIATIVE_COUNT : PUBLIC_DATASETS_COUNT
27+ const variables = isNIH
28+ ? {
29+ query : {
30+ bool : { filter : [ { match : { brainInitiative : { query : "true" } } } ] } ,
31+ } ,
32+ datasetType : "public" ,
33+ }
34+ : { modality }
35+
36+ return useQuery ( query , {
37+ variables,
1638 errorPolicy : "all" ,
1739 } )
1840}
You can’t perform that action at this time.
0 commit comments