Commit 957187e
Eric Bower
·
2026-08-08 11:19:45 -0400 EDT
parent 4451977
fix: sort tasks by created time
1 files changed,
+8,
-0
M
main.go
M
main.go
+8,
-0
| ... | ... | @@ -18,6 +18,7 @@ import ( | |
| 18 | 18 | "os/signal" | |
| 19 | 19 | "path/filepath" | |
| 20 | 20 | "runtime" | |
| 21 | + | "sort" | |
| 21 | 22 | "strconv" | |
| 22 | 23 | "strings" | |
| 23 | 24 | "syscall" |
| ... | ... | @@ -1823,6 +1824,13 @@ func formatTimestamp(ts string) string { | |
| 1823 | 1824 | // sessions for a job with links and metadata (status, exit code, ended at). | |
| 1824 | 1825 | // It also includes any other artifacts in the job directory (e.g., event.json, attestation.json, workspace.tar). | |
| 1825 | 1826 | func generateJobIndex(artifactDir, name, jobID string, sessions []SessionInfo) (htmlContent, txtContent string) { | |
| 1827 | + | // Sort sessions by Created (STARTED) timestamp | |
| 1828 | + | sort.Slice(sessions, func(i, j int) bool { | |
| 1829 | + | ci, _ := strconv.ParseInt(sessions[i].Created, 10, 64) | |
| 1830 | + | cj, _ := strconv.ParseInt(sessions[j].Created, 10, 64) | |
| 1831 | + | return ci < cj | |
| 1832 | + | }) | |
| 1833 | + | ||
| 1826 | 1834 | rows := make([]sessionRow, 0, len(sessions)) | |
| 1827 | 1835 | for _, s := range sessions { | |
| 1828 | 1836 | row := sessionRow{ |