Home | History | Annotate | Download | only in model
      1 <!--
      2 Copyright 2014 The Chromium Authors. All rights reserved.
      3 Use of this source code is governed by a BSD-style license that can be
      4 found in the LICENSE file.
      5 -->
      6 
      7 <link rel="import" href="ct-builder-list.html">
      8 <link rel="import" href="ct-commit-list.html">
      9 
     10 <script>
     11 function CTStepFailureGroupData(failures, commitList) {
     12   this.failures = failures;
     13   this.commitList = commitList;
     14   this.builderList = new CTBuilderList(failures);
     15   this.category = 'step';
     16 };
     17 
     18 CTStepFailureGroupData.prototype.getAnnotations = function() {
     19   return this.failures.map(function(failure) {
     20     return failure.annotations();
     21   }).flatten();
     22 };
     23 
     24 CTStepFailureGroupData.prototype.failureKeys = function() {
     25   return this.failures.map(function(failure) {
     26     return failure.keys();
     27   }).flatten();
     28 };
     29 
     30 CTStepFailureGroupData.prototype.failedOnce = function() {
     31   if (!this.failures.length)
     32     return false;
     33 
     34   for (var i = 0; i < this.failures.length; i++) {
     35     var totalFailures = 0;
     36     var resultNodes = this.failures[i].resultNodesByBuilder;
     37     for (var r in resultNodes) {
     38       totalFailures += resultNodes[r].failingBuildCount;
     39       if (totalFailures > 1)
     40         return false;
     41     }
     42   }
     43   return true;
     44 };
     45 </script>
     46