mirror of
https://github.com/nasa/openmct.git
synced 2025-04-16 15:29:20 +00:00
[Timelines] Remove excessive ternaries
...to improve readability of logic to determine which columns are needed for a given group of domain objects for CSV export, as requested during code review, https://github.com/nasa/openmctweb/pull/728#discussion_r55910477
This commit is contained in:
parent
406a31889e
commit
0ff360ced3
@ -88,21 +88,26 @@ define([
|
||||
|
||||
domainObjects.forEach(function (domainObject) {
|
||||
var model = domainObject.getModel(),
|
||||
compositionLength = model.composition ?
|
||||
model.composition.length : 0,
|
||||
relationshipLength = (model.relationships || {}).modes ?
|
||||
model.relationships.modes.length :
|
||||
0,
|
||||
metadataProperties =
|
||||
domainObject.useCapability('metadata') || [];
|
||||
composition = model.composition,
|
||||
relationships = model.relationships,
|
||||
modes = relationships && relationships.modes,
|
||||
metadataProperties = domainObject.useCapability('metadata');
|
||||
|
||||
maxComposition = Math.max(maxComposition, compositionLength);
|
||||
maxRelationships = Math.max(maxRelationships, relationshipLength);
|
||||
if (composition) {
|
||||
maxComposition = Math.max(maxComposition, composition.length);
|
||||
}
|
||||
|
||||
foundTimespan =
|
||||
foundTimespan || domainObject.hasCapability('timespan');
|
||||
if (modes) {
|
||||
maxRelationships = Math.max(maxRelationships, modes.length);
|
||||
}
|
||||
|
||||
metadataProperties.forEach(addMetadataProperty);
|
||||
if (domainObject.hasCapability('timespan')) {
|
||||
foundTimespan = true;
|
||||
}
|
||||
|
||||
if (metadataProperties) {
|
||||
metadataProperties.forEach(addMetadataProperty);
|
||||
}
|
||||
});
|
||||
|
||||
if (foundTimespan) {
|
||||
@ -153,4 +158,4 @@ define([
|
||||
};
|
||||
|
||||
return TimelineCSVExporter;
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user