Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/opportunities/gate_handler.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/opportunities/gate_handler.go |
| Original SHA-256 | 88b3e40e33009788f534855d75fe16b86a525c7dc8768ab8154df62fed13776e |
| Git blob SHA | 4bf0d99ef8f742ee7a92c038c7c38b3558bc96f6 |
| Reading-copy SHA-256 | 88b3e40e33009788f534855d75fe16b86a525c7dc8768ab8154df62fed13776e |
Recovered source transcript
Download complete source text ↓62 lines · 1.9 KB
package opportunities
import (
"net/http"
"github.com/shopspring/decimal"
)
// captureReview returns the board: every live pursuit, its gate decisions, and what is unresolved.
func (h *Handler) captureReview(w http.ResponseWriter, r *http.Request) {
out, err := h.svc.Review(r.Context(), r.URL.Query().Get("include_closed") == "true")
if err != nil {
writeTeamingErr(w, err)
return
}
writeJSON(w, http.StatusOK, out)
}
func (h *Handler) listGateDecisions(w http.ResponseWriter, r *http.Request) {
id, ok := teamingID(w, r, "id")
if !ok {
return
}
out, err := h.svc.ListDecisions(r.Context(), id)
if err != nil {
writeTeamingErr(w, err)
return
}
writeJSON(w, http.StatusOK, map[string]any{"decisions": out, "count": len(out)})
}
// recordGateDecision writes one go or no go.
//
// The advisory numbers arrive from the CLIENT rather than being recomputed here, and that is deliberate
// rather than lazy. The number that belongs in the record is the one the decider was looking at when they
// decided. Recomputing at write time would store a number nobody saw, which is precisely the rewriting of
// history the snapshot exists to prevent.
func (h *Handler) recordGateDecision(w http.ResponseWriter, r *http.Request) {
id, ok := teamingID(w, r, "id")
if !ok {
return
}
var in struct {
Gate string `json:"gate"`
Decision string `json:"decision"`
Rationale string `json:"rationale"`
ReadinessScore *decimal.Decimal `json:"readiness_score"`
ReadinessBand string `json:"readiness_band"`
WinProbability *decimal.Decimal `json:"win_probability"`
}
if !decodeTeaming(w, r, &in) {
return
}
out, err := h.svc.RecordDecision(r.Context(), id, in.Gate, in.Decision, in.Rationale,
in.ReadinessScore, in.ReadinessBand, in.WinProbability)
if err != nil {
writeTeamingErr(w, err)
return
}
writeJSON(w, http.StatusCreated, out)
}