Conversation
…ty initial amount
| "count", "count"), | ||
| pcs(KindOfQuantity.Count, unit, 1.0, 2, "pcs", | ||
| Quantity.class, | ||
| "pcs", "pcs"), |
There was a problem hiding this comment.
I think singular here is "piece", but might want to confirm that with @labkey-hannah.
There was a problem hiding this comment.
Agreed, we should switch this to "piece"/"pieces"
| assertTrue(Unit.unit.isCompatible(Unit.bottle)); | ||
| assertTrue(Unit.unit.isCompatible(Unit.blocks)); | ||
| assertTrue(Unit.unit.isCompatible(Unit.box)); | ||
| assertTrue(Unit.unit.isCompatible(Unit.slides)); |
There was a problem hiding this comment.
There are some missing here. Not that I think there's risk or regression here, just for completeness.
| {name: 'S-kg', amount: 4.56, units: 'kg'}, | ||
| ], 'samples', sampleTypeMass, topFolderOptions, editorUserOptions); | ||
|
|
||
| // check for storedamount in g |
There was a problem hiding this comment.
check for raw amount in g and display amount in ug
| { | ||
| var ret = wrapColumn(alias, _rootTable.getColumn(AliquotVolume.name())); | ||
| ret.setLabel(ALIQUOT_VOLUME_LABEL); | ||
| ret.setLabel("Raw " + ALIQUOT_VOLUME_LABEL); |
There was a problem hiding this comment.
Would be good to use the label specified from the ExpMaterialTable.Column enum here an for the other new columns so the labels get properly reserved.
| { | ||
| SampleTypeAmountDisplayColumn columnInfo = new SampleTypeAmountDisplayColumn(this, Column.AvailableAliquotVolume.name(), Column.AliquotUnit.name(), AVAILABLE_ALIQUOT_VOLUME_LABEL, Collections.emptySet(), typeUnit); | ||
| columnInfo.setDisplayColumnFactory(colInfo -> new SampleTypeAmountPrecisionDisplayColumn(colInfo, typeUnit)); | ||
| columnInfo.setDescription("The total amount of this sample's aliquots that's available, in the display unit for the sample type, currently on hand."); |
There was a problem hiding this comment.
This doesn't parse very well. Perhaps "The total amount of this sample's available aliquots currently on hand, in the display unit for the sample type."
| public void addQueryFieldKeys(Set<FieldKey> keys) | ||
| { | ||
| super.addQueryFieldKeys(keys); | ||
| keys.add(FieldKey.fromParts(AvailableAliquotVolume)); |
There was a problem hiding this comment.
Same here AvailableAliquotVolume.fieldKey()
| QueryableInputs, | ||
| RawAliquotUnit, | ||
| RawAliquotVolume, | ||
| RawAvailableAliquotVolume, |
There was a problem hiding this comment.
Should set the labels for these fields here.
| String totalUnitsStr; | ||
| if (!StringUtils.isEmpty(sampleTypeUnitsStr)) | ||
| totalUnitsStr = sampleTypeUnitsStr; | ||
| else if (hasSameAliquotUnit && !StringUtils.isEmpty(volumeUnits.get(0).unit)) // if all aliquots have the same unit, prefer it over parent's unit |
There was a problem hiding this comment.
Doesn't this lead to divergence from base units?
There was a problem hiding this comment.
Not really. In the case of an absent display unit, we don't know if aliquot unit or parent unit would be more likely to be in base unit. We don't do conversion when there is no sampleTypeUnitsStr.
There was a problem hiding this comment.
Oh right. Missed that this is the sampletypeUnitStr is empty case.
| } | ||
|
|
||
| private Map<Long, Pair<Integer, String>> getSampleAvailableAliquotCounts(Collection<Long> sampleIds, Collection<Long> availableSampleStates, boolean useRootMaterialLSID) throws SQLException | ||
| private Map<Long, Pair<Integer, String>> getSampleAvailableAliquotCounts(Collection<Long> sampleIds, Collection<Long> availableSampleStates) throws SQLException |
There was a problem hiding this comment.
Nice to get rid of the useRootMaterialLSID complexity.
Rationale
This pull request adds support for additional unit types in the sample type system, particularly extending the Count kind of quantity with new unit types (pcs, pack, blocks, slides, cells, box, kit, tests, bottle) and expanding mass units to include smaller units (ug, ng).
Related Pull Requests
Changes