Skip to content

Commit

Permalink
inverse the ternary op.
Browse files Browse the repository at this point in the history
  • Loading branch information
pjhampton committed Jul 20, 2021
1 parent be52925 commit d2f62d1
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,16 @@ export class TelemetryEndpointTask {
};

// If there is no policy responses in the 24h > now then we will continue
const policyResponses =
failedPolicyResponses.aggregations === undefined ||
failedPolicyResponses.aggregations === null
? new Map<string, EndpointPolicyResponseDocument>()
: failedPolicyResponses.aggregations.policy_responses.buckets.reduce(
(cache, endpointAgentId) => {
const doc = endpointAgentId.latest_response.hits.hits[0];
cache.set(endpointAgentId.key, doc);
return cache;
},
new Map<string, EndpointPolicyResponseDocument>()
);
const policyResponses = failedPolicyResponses.aggregations
? failedPolicyResponses.aggregations.policy_responses.buckets.reduce(
(cache, endpointAgentId) => {
const doc = endpointAgentId.latest_response.hits.hits[0];
cache.set(endpointAgentId.key, doc);
return cache;
},
new Map<string, EndpointPolicyResponseDocument>()
)
: new Map<string, EndpointPolicyResponseDocument>();

/** STAGE 4 - Create the telemetry log records
*
Expand Down

0 comments on commit d2f62d1

Please sign in to comment.