export default function convertTeamcityResponse()

in src/app/teamcity/teamcity-convert.js [62:85]


export default function convertTeamcityResponse(teamcityService, teamcityInvestigationsResponse) {
  const result = {};
  (teamcityInvestigationsResponse.investigation || []).forEach(investigation => {
    const newItem = investigationToItem(investigation);
    if (newItem != null) {
      const item = result[newItem.id] || (result[newItem.id] = newItem);

      if (investigation.target.tests) {
        item.tests = item.tests.concat(investigation.target.tests.test.map(it =>
          test2investigationDetail(teamcityService, it)
        ));
      }
      if (investigation.target.problems) {
        item.problems = item.problems.concat(investigation.target.problems.problem.map(it =>
          problem2investigationDetail(it)
        ));
      }
    }
  });
  return {
    count: teamcityInvestigationsResponse.count || 0,
    data: Object.values(result)
  };
}