go.tools/dashboard: update existing results when builder retries a commit
LGTM=adg R=adg CC=golang-codereviews https://golang.org/cl/96360047
This commit is contained in:
parent
a8c8f48be3
commit
c309b30e41
|
@ -101,6 +101,7 @@ type Commit struct {
|
|||
Desc string `datastore:",noindex"`
|
||||
Time time.Time
|
||||
NeedsBenchmarking bool
|
||||
TryPatch bool
|
||||
|
||||
// ResultData is the Data string of each build Result for this Commit.
|
||||
// For non-Go commits, only the Results for the current Go tip, weekly,
|
||||
|
@ -144,7 +145,19 @@ func (com *Commit) AddResult(c appengine.Context, r *Result) error {
|
|||
if err := datastore.Get(c, com.Key(c), com); err != nil {
|
||||
return fmt.Errorf("getting Commit: %v", err)
|
||||
}
|
||||
|
||||
var resultExists bool
|
||||
for i, s := range com.ResultData {
|
||||
// if there already exists result data for this builder at com, overwrite it.
|
||||
if strings.Contains(s, r.Builder) {
|
||||
resultExists = true
|
||||
com.ResultData[i] = r.Data()
|
||||
}
|
||||
}
|
||||
if !resultExists {
|
||||
// otherwise, add the new result data for this builder.
|
||||
com.ResultData = trim(append(com.ResultData, r.Data()), maxResults)
|
||||
}
|
||||
if _, err := datastore.Put(c, com.Key(c), com); err != nil {
|
||||
return fmt.Errorf("putting Commit: %v", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue