fix: include calendar context in insight responses
This commit is contained in:
@@ -412,6 +412,14 @@ func scanSnapshot(row rowScanner) (Snapshot, error) {
|
|||||||
s.AsOfDate, s.ForecastStart = asOf.Format(time.DateOnly), asOf.Format(time.DateOnly)
|
s.AsOfDate, s.ForecastStart = asOf.Format(time.DateOnly), asOf.Format(time.DateOnly)
|
||||||
s.DataThroughDate = through.Format(time.DateOnly)
|
s.DataThroughDate = through.Format(time.DateOnly)
|
||||||
_ = json.Unmarshal(copyJSON, &s.Copy)
|
_ = json.Unmarshal(copyJSON, &s.Copy)
|
||||||
|
var evidence struct {
|
||||||
|
CalendarContext []CalendarContext `json:"calendarContext"`
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(s.Evidence, &evidence); err == nil && evidence.CalendarContext != nil {
|
||||||
|
s.CalendarContext = evidence.CalendarContext
|
||||||
|
} else {
|
||||||
|
s.CalendarContext = []CalendarContext{}
|
||||||
|
}
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user