Skip to content

Commit

Permalink
ADM-791:[backend]refactor: should get pipeline report and then source…
Browse files Browse the repository at this point in the history
… control report
  • Loading branch information
Dnjoa committed Feb 4, 2024
1 parent 591e916 commit f8995d2
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ public void generateDoraReport(GenerateReportRequest request) {
removePreviousAsyncException(request.getPipelineReportId());
removePreviousAsyncException(request.getSourceControlReportId());
FetchedData fetchedData = new FetchedData();
if (CollectionUtils.isNotEmpty(request.getSourceControlMetrics())) {
GenerateReportRequest sourceControlRequest = request.toSourceControlRequest();
fetchOriginalData(sourceControlRequest, fetchedData);
generateSourceControlReport(sourceControlRequest, fetchedData);
}
if (CollectionUtils.isNotEmpty(request.getPipelineMetrics())) {
GenerateReportRequest pipelineRequest = request.toPipelineRequest();
fetchOriginalData(pipelineRequest, fetchedData);
generatePipelineReport(pipelineRequest, fetchedData);
}
if (CollectionUtils.isNotEmpty(request.getSourceControlMetrics())) {
GenerateReportRequest sourceControlRequest = request.toSourceControlRequest();
fetchOriginalData(sourceControlRequest, fetchedData);
generateSourceControlReport(sourceControlRequest, fetchedData);
}
generateCSVForPipeline(request, fetchedData.getBuildKiteData());
asyncMetricsDataHandler.updateMetricsDataCompletedInHandler(request.getCsvTimeStamp(), DORA);
}
Expand Down Expand Up @@ -243,13 +243,7 @@ private FetchedData fetchOriginalData(GenerateReportRequest request, FetchedData
if (CollectionUtils.isNotEmpty(request.getPipelineMetrics())) {
if (request.getBuildKiteSetting() == null)
throw new BadRequestException("Failed to fetch BuildKite info due to BuildKite setting is null.");
FetchedData.BuildKiteData buildKiteData = pipelineService.fetchBuildKiteInfo(request);
BuildKiteData cachedBuildKiteData = fetchedData.getBuildKiteData();
if (cachedBuildKiteData != null) {
List<PipelineLeadTime> pipelineLeadTimes = cachedBuildKiteData.getPipelineLeadTimes();
buildKiteData.setPipelineLeadTimes(pipelineLeadTimes);
}
fetchedData.setBuildKiteData(buildKiteData);
fetchedData.setBuildKiteData(pipelineService.fetchBuildKiteInfo(request));
}

return fetchedData;
Expand Down

0 comments on commit f8995d2

Please sign in to comment.