fix: resolve remaining hyphenated ID issues in memory store and doctor

This commit is contained in:
Steve Yegge
2025-11-20 19:01:10 -05:00
parent 408244ed73
commit 6a25f5eaa6
4 changed files with 435 additions and 323 deletions

View File

@@ -131,16 +131,20 @@ func (m *MemoryStorage) GetAllIssues() []*types.Issue {
// extractPrefixAndNumber extracts prefix and number from issue ID like "bd-123" -> ("bd", 123)
func extractPrefixAndNumber(id string) (string, int) {
parts := strings.SplitN(id, "-", 2)
if len(parts) != 2 {
lastDash := strings.LastIndex(id, "-")
if lastDash == -1 {
return "", 0
}
prefix := id[:lastDash]
suffix := id[lastDash+1:]
var num int
_, err := fmt.Sscanf(parts[1], "%d", &num)
_, err := fmt.Sscanf(suffix, "%d", &num)
if err != nil {
return "", 0
}
return parts[0], num
return prefix, num
}
// CreateIssue creates a new issue