fix: stop enqueueing disabled external table exports
This commit is contained in:
@@ -49,10 +49,10 @@ func (s *Store) SaveCoverageDecision(ctx context.Context, d coverage.Decision) e
|
||||
return fmt.Errorf("coverage case id: %w", err)
|
||||
}
|
||||
_, err = tx.Exec(ctx, `INSERT INTO support_cases
|
||||
(id, tenant_key, channel, turn_id, coverage_decision_id, status)
|
||||
VALUES($1,$2,$3,$4,$5,$6)
|
||||
(id, tenant_key, channel, turn_id, coverage_decision_id, status, faq_export_status)
|
||||
VALUES($1,$2,$3,$4,$5,$6,$7)
|
||||
ON CONFLICT (tenant_key, channel, turn_id) DO NOTHING`,
|
||||
caseID, d.TenantKey, d.Channel, d.TurnID, persistedDecisionID, "pending")
|
||||
caseID, d.TenantKey, d.Channel, d.TurnID, persistedDecisionID, "pending", faqExportStatus(s.faqExportEnabled))
|
||||
if err != nil {
|
||||
return fmt.Errorf("coverage insert support case: %w", err)
|
||||
}
|
||||
@@ -64,6 +64,13 @@ func (s *Store) SaveCoverageDecision(ctx context.Context, d coverage.Decision) e
|
||||
return nil
|
||||
}
|
||||
|
||||
func faqExportStatus(enabled bool) string {
|
||||
if enabled {
|
||||
return "pending"
|
||||
}
|
||||
return "not_applicable"
|
||||
}
|
||||
|
||||
// newUUID produces a 32-char hex id.
|
||||
func newUUID() (string, error) {
|
||||
var b [16]byte
|
||||
|
||||
Reference in New Issue
Block a user