Skip to content

Commit 2aca870

Browse files
Merge pull request #20 from agile-learning-institute/fix-accurate-collection-failure-reporting
Fix accurate collection failure reporting
2 parents 69f6f3b + 6b83e80 commit 2aca870

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Pipfile.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stage0_mongodb_api/managers/config_manager.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,29 @@ def process_all_collections(self) -> Dict[str, List[Dict]]:
215215

216216
# Add the overall status to each collection's results
217217
for collection_name in results.keys():
218+
# Check if this collection had any errors (excluding overall_status operations)
219+
collection_has_errors = any(
220+
isinstance(op, dict) and op.get("status") == "error"
221+
and op.get("operation") != "overall_status"
222+
for op in results[collection_name]
223+
)
224+
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+
218229
results[collection_name].append({
219230
"operation": "overall_status",
220-
"message": overall_message,
231+
"message": collection_message,
221232
"details_type": "overall",
222233
"details": {
223234
"collections_processed": len(self.collection_configs),
224235
"collections_failed": sum(1 for result in results.values()
225236
if any(isinstance(op, dict) and op.get("status") == "error"
237+
and op.get("operation") != "overall_status"
226238
for op in result))
227239
},
228-
"status": overall_status
240+
"status": collection_status
229241
})
230242

231243
return results

0 commit comments

Comments
 (0)