handle missing field
Browse files
review.py
CHANGED
|
@@ -95,6 +95,8 @@ def apply_review(text: str, review: list[dict]) -> str:
|
|
| 95 |
start = starts[0]
|
| 96 |
end = start + len(entity["term"])
|
| 97 |
output += text[last_end:start]
|
|
|
|
|
|
|
| 98 |
if len(entity["fix"]) > 0:
|
| 99 |
output += get_file("templates/correction.html").format(
|
| 100 |
term=text[start:end], fix=entity["fix"], kind=entity["type"]
|
|
|
|
| 95 |
start = starts[0]
|
| 96 |
end = start + len(entity["term"])
|
| 97 |
output += text[last_end:start]
|
| 98 |
+
if "fix" not in entity:
|
| 99 |
+
entity["fix"] = ""
|
| 100 |
if len(entity["fix"]) > 0:
|
| 101 |
output += get_file("templates/correction.html").format(
|
| 102 |
term=text[start:end], fix=entity["fix"], kind=entity["type"]
|