diff --git a/platform/compliance.go b/platform/compliance.go index 619ec948..838d0a25 100644 --- a/platform/compliance.go +++ b/platform/compliance.go @@ -15,7 +15,7 @@ import ( "github.com/Gleipnir-Technology/nidus-sync/platform/types" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/rs/zerolog/log" + //"github.com/rs/zerolog/log" ) func ComplianceRequestMailerCreate(ctx context.Context, user User, site_id int32) (int32, error) { @@ -111,11 +111,13 @@ func ComplianceReportRequestByLeadID(ctx context.Context, lead_ids []int32) (map results[lead_id] = make([]*types.ComplianceReportRequest, 0) } for _, row := range rows { - crrs, ok := results[row.LeadID.MustGet()] + lead_id := row.LeadID.MustGet() + crrs, ok := results[lead_id] if !ok { return nil, fmt.Errorf("impossible") } crrs = append(crrs, types.ComplianceReportRequestFromModel(row)) + results[lead_id] = crrs } return results, nil } diff --git a/platform/lead.go b/platform/lead.go index c3e245b1..0a846293 100644 --- a/platform/lead.go +++ b/platform/lead.go @@ -48,7 +48,7 @@ func leadCreate(ctx context.Context, txn bob.Executor, user User, signal_id int3 } return &lead.ID, nil } -func leadsBySiteID(ctx context.Context, site_ids []int32) (map[int32][]types.Lead, error) { +func leadsBySiteID(ctx context.Context, site_ids []int32) (map[int32][]*types.Lead, error) { rows, err := bob.All(ctx, db.PGInstance.BobDB, psql.Select( sm.Columns( models.Leads.Columns.ID.As("id"), @@ -59,7 +59,7 @@ func leadsBySiteID(ctx context.Context, site_ids []int32) (map[int32][]types.Lea sm.Where( models.Leads.Columns.SiteID.EQ(psql.Any(site_ids)), ), - ), scan.StructMapper[types.Lead]()) + ), scan.StructMapper[*types.Lead]()) if err != nil { return nil, fmt.Errorf("query leads: %w", err) } @@ -75,9 +75,9 @@ func leadsBySiteID(ctx context.Context, site_ids []int32) (map[int32][]types.Lea } row.ComplianceReportRequests = crrs } - results := make(map[int32][]types.Lead, len(site_ids)) + results := make(map[int32][]*types.Lead, len(site_ids)) for _, site_id := range site_ids { - results[site_id] = make([]types.Lead, 0) + results[site_id] = make([]*types.Lead, 0) } for _, row := range rows { leads, ok := results[row.SiteID] diff --git a/platform/types/site.go b/platform/types/site.go index 96b8329e..8ec819ce 100644 --- a/platform/types/site.go +++ b/platform/types/site.go @@ -13,7 +13,7 @@ type Site struct { Features []Feature `db:"-" json:"features"` FileID int32 `db:"file_id" json:"file_id"` ID int32 `db:"id" json:"id"` - Leads []Lead `db:"-" json:"leads"` + Leads []*Lead `db:"-" json:"leads"` Notes string `db:"notes" json:"notes"` OrganizationID int32 `db:"organization_id" json:"organization_id"` Owner Contact `db:"owner" json:"owner"` diff --git a/ts/components/PlanningColumnList.vue b/ts/components/PlanningColumnList.vue index 679306fb..be897e22 100644 --- a/ts/components/PlanningColumnList.vue +++ b/ts/components/PlanningColumnList.vue @@ -187,8 +187,8 @@ :key="lead.id" class="border rounded p-2 mb-2 signal-item" > -
| {{ lead.type }} | ++ + | +