Fix #94: Handle NULL assignee in epic status query
- Use sql.NullString to scan nullable assignee column - Prevents 'converting NULL to string is unsupported' error - Only set assignee if value is valid (not NULL)
This commit is contained in:
@@ -2,6 +2,7 @@ package sqlite
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"database/sql"
|
||||||
|
|
||||||
"github.com/steveyegge/beads/internal/types"
|
"github.com/steveyegge/beads/internal/types"
|
||||||
)
|
)
|
||||||
@@ -49,11 +50,12 @@ func (s *SQLiteStorage) GetEpicsEligibleForClosure(ctx context.Context) ([]*type
|
|||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var epic types.Issue
|
var epic types.Issue
|
||||||
var totalChildren, closedChildren int
|
var totalChildren, closedChildren int
|
||||||
|
var assignee sql.NullString
|
||||||
|
|
||||||
err := rows.Scan(
|
err := rows.Scan(
|
||||||
&epic.ID, &epic.Title, &epic.Description, &epic.Design,
|
&epic.ID, &epic.Title, &epic.Description, &epic.Design,
|
||||||
&epic.AcceptanceCriteria, &epic.Notes, &epic.Status,
|
&epic.AcceptanceCriteria, &epic.Notes, &epic.Status,
|
||||||
&epic.Priority, &epic.IssueType, &epic.Assignee,
|
&epic.Priority, &epic.IssueType, &assignee,
|
||||||
&epic.EstimatedMinutes, &epic.CreatedAt, &epic.UpdatedAt,
|
&epic.EstimatedMinutes, &epic.CreatedAt, &epic.UpdatedAt,
|
||||||
&epic.ClosedAt, &epic.ExternalRef,
|
&epic.ClosedAt, &epic.ExternalRef,
|
||||||
&totalChildren, &closedChildren,
|
&totalChildren, &closedChildren,
|
||||||
@@ -62,6 +64,11 @@ func (s *SQLiteStorage) GetEpicsEligibleForClosure(ctx context.Context) ([]*type
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert sql.NullString to string
|
||||||
|
if assignee.Valid {
|
||||||
|
epic.Assignee = assignee.String
|
||||||
|
}
|
||||||
|
|
||||||
eligibleForClose := false
|
eligibleForClose := false
|
||||||
if totalChildren > 0 && closedChildren == totalChildren {
|
if totalChildren > 0 && closedChildren == totalChildren {
|
||||||
eligibleForClose = true
|
eligibleForClose = true
|
||||||
|
|||||||
Reference in New Issue
Block a user