From 13e9a5b0d9d19263455ea48ddc9dd5e394cda5cd Mon Sep 17 00:00:00 2001 From: Brian Ginsburg Date: Fri, 6 Dec 2024 16:08:57 -0800 Subject: [PATCH] feat: Add GetMatchDecisions method --- pkg/solver/store/db/db.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/solver/store/db/db.go b/pkg/solver/store/db/db.go index a9b8685f..75f082ed 100644 --- a/pkg/solver/store/db/db.go +++ b/pkg/solver/store/db/db.go @@ -246,8 +246,17 @@ func (store *SolverStoreDatabase) GetResults() ([]data.Result, error) { } func (store *SolverStoreDatabase) GetMatchDecisions() ([]data.MatchDecision, error) { - var results []data.MatchDecision - return results, nil + var records []MatchDecision + if err := store.db.Find(&records).Error; err != nil { + return nil, err + } + + decisions := make([]data.MatchDecision, len(records)) + for i, record := range records { + decisions[i] = record.Attributes.Data() + } + + return decisions, nil } func (store *SolverStoreDatabase) GetJobOffer(id string) (*data.JobOfferContainer, error) {