Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/matching/mission_service.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 3be46ba89edb737182075a2b320509b42dc916f8 |
| Branch | workstream-d-missionmatch |
| Path or archive member | internal/modules/matching/mission_service.go |
| Original SHA-256 | 96bc314fc9ae85da3e2691599e979f561eb302a0dbcf3b0607b7665b33ca20d1 |
| Git blob SHA | 9cb30ba26d58467f4ee50ebd2c2b66ff639bdd61 |
| Reading-copy SHA-256 | 96bc314fc9ae85da3e2691599e979f561eb302a0dbcf3b0607b7665b33ca20d1 |
Recovered source transcript
Download complete source text ↓55 lines · 1.9 KB
package matching
import (
"context"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"github.com/missionworkforce/missionmatch/internal/platform/database/dbgen"
)
// SupportView is one candidate who can support a mission today, read from the persisted screenMATCH
// qualification (the stored artifact), never a rescore. It carries the frozen total and band so the
// number matches what screenMATCH and slateMATCH show for the same candidate.
type SupportView struct {
CandidateID string `json:"candidate_id"`
FullName string `json:"full_name"`
Total string `json:"total_score"`
Band string `json:"band"`
BandLabel string `json:"band_label"`
Available bool `json:"available"`
EvaluatedAt string `json:"evaluated_at"`
}
// WhoCanSupport returns the candidates with a persisted screenMATCH qualification for one requirement,
// best first (the missionMATCH "who can support this mission today" rollup). It READS the stored
// candidate_evaluations rows; it never rescores the pool, so the rollup agrees with the screen and the
// slate to the cent. An empty result means no one has been screened against the requirement yet.
func (s *Service) WhoCanSupport(ctx context.Context, requirementID uuid.UUID) ([]SupportView, error) {
if s.db == nil {
return nil, ErrNoDatabase
}
var out []SupportView
err := s.db.RunInTenantTx(ctx, func(ctx context.Context, tx pgx.Tx) error {
rows, e := dbgen.New(tx).ListEvaluationsForRequirement(ctx, requirementID)
if e != nil {
return e
}
out = make([]SupportView, len(rows))
for i, r := range rows {
out[i] = SupportView{
CandidateID: r.CandidateID.String(),
FullName: r.FullName,
Total: r.TotalScore.StringFixed(2),
Band: r.Band,
BandLabel: bandLabel(r.Band),
Available: r.Available,
EvaluatedAt: r.EvaluatedAt.Format("2006-01-02"),
}
}
return nil
})
return out, err
}