PR review changes

pull/10616/head
zhulongcheng 2018-11-28 20:45:25 +08:00
parent 03c0b4c896
commit 0c68d3126f
1 changed files with 4 additions and 4 deletions

View File

@ -560,17 +560,17 @@ func decodeGetRunsRequest(ctx context.Context, r *http.Request, orgs platform.Or
req.filter.Limit = i
}
var at, bt string
var afterTime, beforeTime time.Time
if at := qp.Get("afterTime"); at != "" {
if at = qp.Get("afterTime"); at != "" {
afterTime, err = time.Parse(time.RFC3339, at)
if err != nil {
return nil, err
}
req.filter.AfterTime = at
}
if bt := qp.Get("beforeTime"); bt != "" {
if bt = qp.Get("beforeTime"); bt != "" {
beforeTime, err = time.Parse(time.RFC3339, bt)
if err != nil {
return nil, err
@ -578,7 +578,7 @@ func decodeGetRunsRequest(ctx context.Context, r *http.Request, orgs platform.Or
req.filter.BeforeTime = bt
}
if &afterTime != nil && &beforeTime != nil && afterTime.Sub(beforeTime).Nanoseconds() > 0 {
if at != "" && bt != "" && afterTime.Sub(beforeTime).Nanoseconds() > 0 {
return nil, kerrors.InvalidDataf("beforeTime must be greater than afterTime")
}