Skip to content

Commit eddccea

Browse files
author
Shreyas-Microsoft
committed
fix failing test
1 parent 8a8d476 commit eddccea

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/backend/common/services/batch_service.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,22 @@ async def get_batch_summary(self, batch_id: str, user_id: str) -> Optional[Dict]
142142
try:
143143
logs = await self.database.get_file_logs(file["file_id"])
144144
file["logs"] = logs
145-
# Try to get translated content for completed files
146-
if file.get("status") == "completed":
147-
try:
148-
translated_content = await self.get_file_translated(file)
149-
file["translated_content"] = translated_content
150-
except Exception as e:
151-
self.logger.error(
152-
f"Error retrieving translated content for file {file['file_id']}: {str(e)}"
153-
)
145+
# Try to get translated content for all files, but prioritize completed files
146+
try:
147+
translated_content = await self.get_file_translated(file)
148+
file["translated_content"] = translated_content
149+
except Exception as e:
150+
self.logger.error(
151+
f"Error retrieving translated content for file {file['file_id']}: {str(e)}"
152+
)
153+
# Ensure translated_content field exists even if empty
154+
file["translated_content"] = ""
154155
except Exception as e:
155156
self.logger.error(
156157
f"Error retrieving logs for file {file['file_id']}: {str(e)}"
157158
)
158159
file["logs"] = [] # Set empty logs on error
160+
file["translated_content"] = "" # Ensure field exists
159161

160162
return {
161163
"files": files,

0 commit comments

Comments
 (0)