with changing unit preferences and such to use the user object and not local storage, the decriber needed to be updated as well and i missed that part, so now describeMeasurement takes in an optional user and uses its settings for the unit and such and when not passed in will use the defaults

This commit is contained in:
csawatzky 2026-04-01 10:42:16 -06:00
parent 9d41499c27
commit 52c8a02af3
18 changed files with 117 additions and 56 deletions

View file

@ -71,7 +71,7 @@ interface Props {
export default function InteractionsOverview(props: Props) {
const classes = useStyles();
const [{as}] = useGlobalState();
const [{as, user}] = useGlobalState();
const interactionsAPI = useInteractionsAPI();
const { success, error } = useSnackbar();
const { device, component, components, permissions, refreshCallback } = props;
@ -118,12 +118,12 @@ export default function InteractionsOverview(props: Props) {
if (!conditions) return items;
conditions.forEach((condition: pond.IInteractionCondition, conditionIndex: number) => {
let measurementType = condition.measurementType;
let measurement = describeMeasurement(condition.measurementType, sourceType, sourceSubtype);
let measurement = describeMeasurement(condition.measurementType, sourceType, sourceSubtype, undefined, user);
items.push(
<Grid container size={{ sm: 12 }} key={conditionIndex} alignItems="center">
<Grid size={{ xs: 12, sm: 6 }}>
<Typography variant="caption" gutterBottom>
{interactionConditionText(source, condition, conditionIndex > 0)}
{interactionConditionText(source, condition, conditionIndex > 0, user)}
</Typography>
</Grid>
<Grid size={{ xs: 12, sm: 6 }}>
@ -185,7 +185,7 @@ export default function InteractionsOverview(props: Props) {
let condition = conditions[conditionIndex];
let sourceType = source && source.settings.type;
let sourceSubtype = source && source.settings.subtype;
let describer = describeMeasurement(condition.measurementType, sourceType, sourceSubtype);
let describer = describeMeasurement(condition.measurementType, sourceType, sourceSubtype, undefined, user);
condition.value = describer.toStored(value);
updatedDirtyInteractions.set(interactionIndex, true);
}