Skip to content

Commit 6b83e80

Browse files
author
Mike Storey
committed
Fix: overall_status now reflects individual collection success/failure, not overall processing status
1 parent bbbb089 commit 6b83e80

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

stage0_mongodb_api/managers/config_manager.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def process_all_collections(self) -> Dict[str, List[Dict]]:
213213
overall_status = "error" if any_collection_failed else "success"
214214
overall_message = "Some collections failed to process" if any_collection_failed else "All collections processed successfully"
215215

216-
# Add the overall status only to collections that actually failed
216+
# Add the overall status to each collection's results
217217
for collection_name in results.keys():
218218
# Check if this collection had any errors (excluding overall_status operations)
219219
collection_has_errors = any(
@@ -222,21 +222,23 @@ def process_all_collections(self) -> Dict[str, List[Dict]]:
222222
for op in results[collection_name]
223223
)
224224

225-
# Only add overall_status to collections that failed
226-
if collection_has_errors:
227-
results[collection_name].append({
228-
"operation": "overall_status",
229-
"message": overall_message,
230-
"details_type": "overall",
231-
"details": {
232-
"collections_processed": len(self.collection_configs),
233-
"collections_failed": sum(1 for result in results.values()
234-
if any(isinstance(op, dict) and op.get("status") == "error"
235-
and op.get("operation") != "overall_status"
236-
for op in result))
237-
},
238-
"status": overall_status
239-
})
225+
# Determine this collection's status
226+
collection_status = "error" if collection_has_errors else "success"
227+
collection_message = "Collection processing failed" if collection_has_errors else "Collection processed successfully"
228+
229+
results[collection_name].append({
230+
"operation": "overall_status",
231+
"message": collection_message,
232+
"details_type": "overall",
233+
"details": {
234+
"collections_processed": len(self.collection_configs),
235+
"collections_failed": sum(1 for result in results.values()
236+
if any(isinstance(op, dict) and op.get("status") == "error"
237+
and op.get("operation") != "overall_status"
238+
for op in result))
239+
},
240+
"status": collection_status
241+
})
240242

241243
return results
242244

0 commit comments

Comments
 (0)