Keep CheckInAt time empty when it is empty (#17877)

Fixes #17860

Signed-off-by: stonezdj <daojunz@vmware.com>

Signed-off-by: stonezdj <daojunz@vmware.com>
This commit is contained in:
stonezdj(Daojun Zhang) 2022-11-28 14:02:30 +08:00 committed by GitHub
parent bcbfad632a
commit 80999f28ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,16 +86,23 @@ func toWorkerResponse(wks []*jm.Worker) []*models.Worker {
PoolID: w.PoolID,
})
} else {
startAtTime := covertTime(w.StartedAt)
checkInAtTime := covertTime(w.CheckInAt)
var startAtTime, checkInAtTime *strfmt.DateTime
if w.StartedAt != 0 {
t := covertTime(w.StartedAt)
startAtTime = &t
}
if w.CheckInAt != 0 {
t := covertTime(w.CheckInAt)
checkInAtTime = &t
}
workers = append(workers, &models.Worker{
ID: w.ID,
JobName: w.JobName,
JobID: w.JobID,
PoolID: w.PoolID,
Args: w.Args,
StartAt: &startAtTime,
CheckinAt: &checkInAtTime,
StartAt: startAtTime,
CheckinAt: checkInAtTime,
})
}
}