public getAccidents()

in dashboard/new-dashboard/src/configurators/accidents/AccidentsConfigurator.ts [162:205]


  public getAccidents(value: string[] | number[] | null): Accident[] | null {
    const accidents = this.value.value
    if (accidents != undefined && value != null) {
      let build = ""
      let key = ""
      let keyWithMetric = ""
      if (this.dbType == DBType.FLEET) {
        build = value[9] == 0 ? `${value[7]}.${value[8]}` : `${value[7]}.${value[8]}.${value[9]}`
        key = `${value[5]}_${build}`
        keyWithMetric = `${value[5]}/${value[2]}_${build}`
      }
      if (this.dbType == DBType.STARTUP_TESTS) {
        build = `${value[7]}.${value[8]}`
        key = `${value[5]}_${build}`
        keyWithMetric = `${value[5]}/${value[2]}_${build}`
      }
      if (this.dbType == DBType.INTELLIJ) {
        build = value[10] == 0 ? `${value[8]}.${value[9]}` : `${value[8]}.${value[9]}.${value[10]}`
        key = `${value[6]}_${build}`
        keyWithMetric = `${value[6]}/${value[2]}_${build}`
      }
      if (
        this.dbType == DBType.INTELLIJ_DEV ||
        this.dbType == DBType.PERF_UNIT_TESTS ||
        this.dbType == DBType.BAZEL ||
        this.dbType == DBType.FLEET_PERF ||
        this.dbType == DBType.DIOGEN
      ) {
        build = `${value[5]}`
        key = `${value[6]}_${build}`
        keyWithMetric = `${value[6]}/${value[2]}_${build}`
      }
      if (this.dbType == DBType.STARTUP_TESTS_DEV) {
        build = `${value[4]}`
        key = `${value[5]}_${build}`
        keyWithMetric = `${value[5]}/${value[2]}_${build}`
      }
      const buildAccident = accidents.get(`_${build}`) ?? []
      const testAccident = accidents.get(key) ?? []
      const metricAccident = accidents.get(keyWithMetric) ?? []
      return [...testAccident, ...buildAccident, ...metricAccident]
    }
    return null
  }