[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:
Victor Woeltjen 2016-03-14 11:53:28 -07:00
parent 406a31889e
commit 0ff360ced3

View File

@ -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;
});
});