mirror of
https://github.com/AmanTahiliani/box-box.git
synced 2026-08-08 04:06:18 -04:00
Show cancelled schedule status
This commit is contained in:
@@ -430,6 +430,27 @@ func (s *Service) ingestSessionDatasets(sess models.Session) (Summary, error) {
|
||||
coverage = make(map[string]store.CoverageEntry)
|
||||
}
|
||||
|
||||
if sess.IsCancelled {
|
||||
s.opts.Progress.Step("session %d (%s) is cancelled; skipping Race Hub datasets", sessionKey, sess.SessionName)
|
||||
if !s.opts.DryRun {
|
||||
for _, dataset := range []string{
|
||||
"drivers",
|
||||
"session_result",
|
||||
"starting_grid",
|
||||
"stints",
|
||||
"pit_stops",
|
||||
"positions",
|
||||
"race_control",
|
||||
"weather",
|
||||
"laps",
|
||||
} {
|
||||
_ = s.store.UpsertCoverage(sessionKey, dataset, "skipped", 0, "session cancelled")
|
||||
}
|
||||
}
|
||||
summary.Status = statusForCancelled(s.opts.DryRun)
|
||||
return summary, nil
|
||||
}
|
||||
|
||||
// 1. Ingest drivers
|
||||
if cov, ok := coverage["drivers"]; ok && cov.Status == "complete" && !s.opts.Force {
|
||||
s.opts.Progress.Step("drivers already complete for session %d, skipping", sessionKey)
|
||||
@@ -919,6 +940,13 @@ func statusForErrors(dryRun bool, errs []string) string {
|
||||
return "completed"
|
||||
}
|
||||
|
||||
func statusForCancelled(dryRun bool) string {
|
||||
if dryRun {
|
||||
return "dry_run"
|
||||
}
|
||||
return "cancelled"
|
||||
}
|
||||
|
||||
type fetchFunc[T any] func() (FetchResult, T, error)
|
||||
|
||||
func fetchWithRetry[T any](s *Service, fn fetchFunc[T]) (FetchResult, T, error) {
|
||||
|
||||
Reference in New Issue
Block a user