Spaces:
Sleeping
Sleeping
Refactor timestamp handling in ReadmeGeneratorService to simplify logic and ensure default value is 'Unverified'
Browse files
app/services/analysis/readme_generator.py
CHANGED
|
@@ -127,17 +127,16 @@ class ReadmeGeneratorService:
|
|
| 127 |
f"- {i18n[language]['geolocationTitle']}: {request.location_analysis.latitude}, {request.location_analysis.longitude}",
|
| 128 |
]
|
| 129 |
|
| 130 |
-
timestamp_value = getattr(request, "timestamp", None)
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
)
|
| 141 |
|
| 142 |
case_summary_section = "\n".join(case_summary_lines) + "\n"
|
| 143 |
content_classification_section = f"""
|
|
|
|
| 127 |
f"- {i18n[language]['geolocationTitle']}: {request.location_analysis.latitude}, {request.location_analysis.longitude}",
|
| 128 |
]
|
| 129 |
|
| 130 |
+
timestamp_value = getattr(request, "timestamp", None) or "Unverified"
|
| 131 |
+
display_timestamp = (
|
| 132 |
+
i18n[language].get("unverified", timestamp_value)
|
| 133 |
+
if isinstance(timestamp_value, str)
|
| 134 |
+
and timestamp_value.strip().lower() == "unverified"
|
| 135 |
+
else timestamp_value
|
| 136 |
+
)
|
| 137 |
+
case_summary_lines.append(
|
| 138 |
+
f"- {i18n[language]['dateTitle']}: {display_timestamp}"
|
| 139 |
+
)
|
|
|
|
| 140 |
|
| 141 |
case_summary_section = "\n".join(case_summary_lines) + "\n"
|
| 142 |
content_classification_section = f"""
|