Skip to content

Commit

Permalink
Revert changes in getServices due to readability concerns
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Nov 21, 2019
1 parent b433369 commit 5bf33fd
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ export type ServiceListAPIResponse = PromiseReturnType<typeof getServices>;
export async function getServices(
setup: Setup & SetupTimeRange & SetupUIFilters
) {
const itemsPromise = getServicesItems(setup);
const hasLegacyDataPromise = getLegacyDataStatus(setup);
const items = await itemsPromise;
const [items, hasLegacyData] = await Promise.all([
getServicesItems(setup),
getLegacyDataStatus(setup)
]);

const noDataInCurrentTimeRange = isEmpty(items);
const hasHistoricalData = noDataInCurrentTimeRange
? await hasHistoricalAgentData(setup)
: true;

return {
items,
hasHistoricalData: noDataInCurrentTimeRange
? await hasHistoricalAgentData(setup)
: true,
hasLegacyData: await hasLegacyDataPromise
hasHistoricalData,
hasLegacyData
};
}

0 comments on commit 5bf33fd

Please sign in to comment.