Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
bchu1 committed Jan 10, 2025
1 parent 47fed70 commit 74b9a82
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { gql } from 'app/__generated_v2__'

/**
* Shares filter options queries between datasets and deposition pages (filters are near identical).
* Shares aggregate queries between datasets and deposition pages (the 2 pages are very similar).
*
* Parent query must define $depositionFilter.
* Parent query must define $depositionIdFilter. If $depositionIdFilter is undefined, the queries
* will count everything. It makes the fragment significantly more readable to allow sending an
* empty argument object.
*/
export const GET_DATASETS_FILTER_VALUES_FRAGMENT = gql(`
export const GET_DATASETS_AGGREGATES_FRAGMENT = gql(`
fragment DatasetsAggregates on Query {
distinctOrganismNames: datasetsAggregate(where: { depositionId: $depositionFilter }) {
distinctOrganismNames: datasetsAggregate(where: { depositionId: $depositionIdFilter }) {
aggregate {
count
groupBy {
Expand All @@ -16,7 +18,7 @@ export const GET_DATASETS_FILTER_VALUES_FRAGMENT = gql(`
}
}
distinctCameraManufacturers: tiltseriesAggregate(where: { depositionId: $depositionFilter }) {
distinctCameraManufacturers: tiltseriesAggregate(where: { depositionId: $depositionIdFilter }) {
aggregate {
count
groupBy {
Expand All @@ -25,7 +27,7 @@ export const GET_DATASETS_FILTER_VALUES_FRAGMENT = gql(`
}
}
distinctReconstructionMethods: tomogramsAggregate(where: { depositionId: $depositionFilter }) {
distinctReconstructionMethods: tomogramsAggregate(where: { depositionId: $depositionIdFilter }) {
aggregate {
count
groupBy {
Expand All @@ -34,7 +36,7 @@ export const GET_DATASETS_FILTER_VALUES_FRAGMENT = gql(`
}
}
distinctReconstructionSoftwares: tomogramsAggregate(where: { depositionId: $depositionFilter }) {
distinctReconstructionSoftwares: tomogramsAggregate(where: { depositionId: $depositionIdFilter }) {
aggregate {
count
groupBy {
Expand All @@ -43,7 +45,7 @@ export const GET_DATASETS_FILTER_VALUES_FRAGMENT = gql(`
}
}
distinctObjectNames: annotationsAggregate(where: { depositionId: $depositionFilter }) {
distinctObjectNames: annotationsAggregate(where: { depositionId: $depositionIdFilter }) {
aggregate {
count
groupBy {
Expand All @@ -52,7 +54,7 @@ export const GET_DATASETS_FILTER_VALUES_FRAGMENT = gql(`
}
}
distinctShapeTypes: annotationShapesAggregate(where: { annotation: { depositionId: $depositionFilter } }) {
distinctShapeTypes: annotationShapesAggregate(where: { annotation: { depositionId: $depositionIdFilter } }) {
aggregate {
count
groupBy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const GET_DATASETS_QUERY = gql(`
$offset: Int,
$orderBy: [DatasetOrderByClause!]!,
$filter: DatasetWhereClause!,
$depositionFilter: IntComparators # Unused, but must be defined because DatasetsFilterValues references it.
$depositionIdFilter: IntComparators # Unused, but must be defined because DatasetsFilterValues references it.
) {
datasets(
where: $filter
Expand Down Expand Up @@ -80,7 +80,7 @@ const GET_DATASETS_QUERY = gql(`
}
}
...DatasetsFilterValues
...DatasetsAggregates @include(if: $filterByDeposition)
}
`)

Expand Down

0 comments on commit 74b9a82

Please sign in to comment.