mirror of
https://github.com/AmanTahiliani/box-box.git
synced 2026-08-07 19:56:18 -04:00
fix(#76): report request-scoped data freshness
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func (s *Server) handleWeekendContext(w http.ResponseWriter, _ *http.Request) {
|
||||
markLocalResponse(w, false)
|
||||
if !s.hasLocalQuery() {
|
||||
writeJSON(w, query.WeekendContext{TemporalState: query.TemporalNoSeason})
|
||||
return
|
||||
@@ -29,6 +30,12 @@ func (s *Server) handleWeekendContext(w http.ResponseWriter, _ *http.Request) {
|
||||
writeError(w, err, http.StatusInternalServerError, false)
|
||||
return
|
||||
}
|
||||
for _, ref := range []*query.ContextSession{context.ActiveSession, context.PreviousCompletedSession, context.DefaultAnalysisSession, context.NextSession} {
|
||||
if ref != nil && ref.Availability.Freshness != "local" {
|
||||
markDataResponse(w, ref.Availability.Source, ref.Availability.Freshness)
|
||||
break
|
||||
}
|
||||
}
|
||||
writeJSON(w, context)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user