Skip to content

Commit

Permalink
Applied patch to order containers by name instead of barcode.
Browse files Browse the repository at this point in the history
  • Loading branch information
UlysseFG committed Oct 18, 2023
1 parent b61d2e7 commit 1234f89
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion backend/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.5.1
4.5.2
2 changes: 2 additions & 0 deletions backend/fms_core/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ class Meta:
fields = _pooled_sample_filterset_fields

class SampleNextStepFilter(GenericFilter):
sample__container__barcode = django_filters.CharFilter(field_name="sample__container__barcode", method="batch_filter")
sample__container__location__barcode = django_filters.CharFilter(field_name="sample__container__location__barcode", method="batch_filter")

qc_flag__in = django_filters.CharFilter(method="qc_flag_filter")
quantity_ng__lte = django_filters.NumberFilter(method="quantity_ng_lte_filter")
Expand Down
8 changes: 4 additions & 4 deletions backend/fms_core/viewsets/sample_next_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ class SampleNextStepViewSet(viewsets.ModelViewSet, TemplateActionsMixin, Templat
)

queryset = queryset.annotate(
ordering_container_barcode=Case(
When(Q(sample__coordinate__isnull=True), then=F('sample__container__location__barcode')),
default=F('sample__container__barcode'),
ordering_container_name=Case(
When(Q(sample__coordinate__isnull=True), then=F('sample__container__location__name')),
default=F('sample__container__name'),
output_field=CharField()
)
)
Expand Down Expand Up @@ -66,7 +66,7 @@ class SampleNextStepViewSet(viewsets.ModelViewSet, TemplateActionsMixin, Templat
}
ordering_fields = {
*_list_keys(_sample_next_step_filterset_fields),
'ordering_container_barcode',
'ordering_container_name',
'ordering_container_coordinate_column',
'ordering_container_coordinate_row',
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/labwork/step/LabworkStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ const LabworkStep = ({ protocol, step, stepSamples }: LabworkStepPageProps) => {
selection={selectionProps}
setSortBy={handleSelectionTableSortChange}
/>
<Space><InfoCircleOutlined /><Text italic>Samples are automatically sorted by container barcode and then by coordinate.</Text></Space>
<Space><InfoCircleOutlined /><Text italic>Samples are automatically sorted by <Text italic strong>container name</Text> and then by <Text italic strong>coordinate</Text>.</Text></Space>
</Tabs.TabPane>
</Tabs>
</PageContent>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/samples/SampleTableColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,12 @@ export const SAMPLE_COLUMN_FILTERS: { [key in SampleColumnID]: FilterDescription
key: UNDEFINED_FILTER_KEY,
label: 'Parent Container Barcode',
recursive: true,
batch: true,
},
[SampleColumnID.PARENT_COORDINATES]: {
type: FILTER_TYPE.INPUT,
key: UNDEFINED_FILTER_KEY,
label: 'Parent Coords',
recursive: true,
},
[SampleColumnID.CONTAINER_NAME]: {
type: FILTER_TYPE.INPUT,
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/modules/labworkSteps/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { CoordinateSortDirection } from "./models"
export function getCoordinateOrderingParams(sort: CoordinateSortDirection) {
if (sort.orientation === 'column') {
return sort.order === 'descend' ?
'ordering_container_barcode,-ordering_container_coordinate_column,-ordering_container_coordinate_row'
'ordering_container_name,-ordering_container_coordinate_column,-ordering_container_coordinate_row'
:
'ordering_container_barcode,ordering_container_coordinate_column,ordering_container_coordinate_row'
'ordering_container_name,ordering_container_coordinate_column,ordering_container_coordinate_row'
} else {
return sort.order === 'descend' ?
'ordering_container_barcode,-ordering_container_coordinate_row,-ordering_container_coordinate_column'
'ordering_container_name,-ordering_container_coordinate_row,-ordering_container_coordinate_column'
:
'ordering_container_barcode,ordering_container_coordinate_row,ordering_container_coordinate_column'
'ordering_container_name,ordering_container_coordinate_row,ordering_container_coordinate_column'
}
}

Expand Down

0 comments on commit 1234f89

Please sign in to comment.