Skip to content

Commit

Permalink
Merge pull request #41 from cesmii/feature/attribute-value-default
Browse files Browse the repository at this point in the history
feat(frontend): changed default attribute value to time series, then …
  • Loading branch information
scott181182 authored Jun 5, 2024
2 parents 19000bb + e1c6a2b commit ca4c2fc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/lib/equipment/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ function parseTimeSeriesValue(attribute: AttributeOverviewFragment, ts: TimeSeri
}
}
function parseAttribute<T extends ScalarTypeEnum = ScalarTypeEnum>(attribute: AttributeOverviewFragment): IAttribute<T> {
let value = parseAttributeValue(attribute);
if((value === null || value === undefined) && attribute.getTimeSeries?.[0]) {
let value: AttributeValue | undefined = undefined;
if(attribute.getTimeSeries?.[0]) {
value = parseTimeSeriesValue(attribute, attribute.getTimeSeries[0]);
}

if(value === undefined || value === null) {
value = parseAttributeValue(attribute);
}

return {
id: attribute.id,
Expand Down

0 comments on commit ca4c2fc

Please sign in to comment.