|
46 | 46 |
|
47 | 47 |
|
48 | 48 | def extract_method_from_body(body: str) -> Optional[str]: |
49 | | - """Extract method name from issue body (template field or query param).""" |
| 49 | + """Extract method name from issue body (markdown template or query param).""" |
50 | 50 | if not body: |
51 | 51 | return None |
52 | 52 |
|
53 | | - # Try to find method from template field (dropdown) |
| 53 | + # Try to find method from markdown template format: **Method:** method_name |
| 54 | + method_match = re.search(r'\*\*Method:\*\*\s*([^\n]+)', body, re.IGNORECASE) |
| 55 | + if method_match: |
| 56 | + method = method_match.group(1).strip().lower() |
| 57 | + # Remove markdown code blocks and normalize |
| 58 | + method = method.replace("`", "").replace("<!--", "").replace("-->", "").strip() |
| 59 | + method = method.replace(" ", "-").replace("_", "-") |
| 60 | + if method in METHODS: |
| 61 | + return method |
| 62 | + |
| 63 | + # Try to find from template field format (old YAML form): ### Analysis Method |
54 | 64 | method_match = re.search(r'###\s*Analysis Method\s*\n\s*([^\n]+)', body, re.IGNORECASE) |
55 | 65 | if method_match: |
56 | 66 | method = method_match.group(1).strip().lower() |
57 | | - # Normalize common variations |
58 | 67 | method = method.replace(" ", "-").replace("_", "-") |
59 | 68 | if method in METHODS: |
60 | 69 | return method |
@@ -82,11 +91,20 @@ def extract_rating_from_labels(labels: List[Any]) -> Optional[str]: |
82 | 91 |
|
83 | 92 |
|
84 | 93 | def extract_rating_from_body(body: str) -> Optional[str]: |
85 | | - """Extract rating from issue body (template dropdown field).""" |
| 94 | + """Extract rating from issue body (markdown template checkboxes).""" |
86 | 95 | if not body: |
87 | 96 | return None |
88 | 97 |
|
89 | | - # Try to find rating from template field (dropdown) |
| 98 | + # Try to find rating from markdown template checkboxes |
| 99 | + # Format: - [x] Correct or - [x] Needs Review or - [x] Incorrect |
| 100 | + if re.search(r'-\s*\[x\]\s*Correct', body, re.IGNORECASE): |
| 101 | + return "correct" |
| 102 | + elif re.search(r'-\s*\[x\]\s*Incorrect', body, re.IGNORECASE): |
| 103 | + return "incorrect" |
| 104 | + elif re.search(r'-\s*\[x\]\s*Needs Review', body, re.IGNORECASE): |
| 105 | + return "needs-review" |
| 106 | + |
| 107 | + # Fallback: Try to find rating from old template field (dropdown) |
90 | 108 | rating_match = re.search(r'###\s*Rating\s*\n\s*([^\n]+)', body, re.IGNORECASE) |
91 | 109 | if rating_match: |
92 | 110 | rating = rating_match.group(1).strip() |
|
0 commit comments