Spaces:
Running
Running
bugfix#3 (#19)
Browse files- Ars/controllers.py +4 -2
- Ars/repositories.py +2 -2
Ars/controllers.py
CHANGED
@@ -31,7 +31,9 @@ async def resilience_analysis(file:UploadFile,userId:str):
|
|
31 |
boost_suggestion = generate_boost_suggestion(resume=resume,skil_depth=skill_depth,risk=risk,ai_readiness=ai_readiness)
|
32 |
domain_breakdown = generate_domain_breakdown(resume=resume,skil_depth=skill_depth,risk=risk,ai_readiness=ai_readiness)
|
33 |
final_analysis_response ={"overall score": ResilienceScore,"flagged Risk": flagged_risk,"boost suggestion":boost_suggestion,"domain breakdown":domain_breakdown,"resume":resume,"skil_depth":skill_depth,"risk":risk,"ai_readiness":ai_readiness}
|
34 |
-
await create_new_hashed_doc_entry(data={"hashed_doc":hashed_doc,"resume":final_analysis_response,"userId":userId})
|
35 |
-
|
|
|
|
|
36 |
else:
|
37 |
return check
|
|
|
31 |
boost_suggestion = generate_boost_suggestion(resume=resume,skil_depth=skill_depth,risk=risk,ai_readiness=ai_readiness)
|
32 |
domain_breakdown = generate_domain_breakdown(resume=resume,skil_depth=skill_depth,risk=risk,ai_readiness=ai_readiness)
|
33 |
final_analysis_response ={"overall score": ResilienceScore,"flagged Risk": flagged_risk,"boost suggestion":boost_suggestion,"domain breakdown":domain_breakdown,"resume":resume,"skil_depth":skill_depth,"risk":risk,"ai_readiness":ai_readiness}
|
34 |
+
resultId =await create_new_hashed_doc_entry(data={"hashed_doc":hashed_doc,"resume":final_analysis_response,"userId":userId})
|
35 |
+
if resultId['error']==None:
|
36 |
+
return final_analysis_response
|
37 |
+
|
38 |
else:
|
39 |
return check
|
Ars/repositories.py
CHANGED
@@ -10,8 +10,8 @@ async def create_new_hashed_doc_entry(data: dict):
|
|
10 |
|
11 |
try:
|
12 |
# Attempt to insert the document, ensuring hashed_doc is unique due to the index
|
13 |
-
result = await db.resume_resilience_analysis.insert_one(data)
|
14 |
-
return {"inserted_id": result.inserted_id} # Return the inserted ID
|
15 |
except pymongo.errors.DuplicateKeyError:
|
16 |
# Handle the case where a document with the same 'hashed_doc' already exists
|
17 |
return {"error": "Document with this 'hashed_doc' already exists"}
|
|
|
10 |
|
11 |
try:
|
12 |
# Attempt to insert the document, ensuring hashed_doc is unique due to the index
|
13 |
+
result = await db.resume_resilience_analysis.insert_one(document=data)
|
14 |
+
return {"inserted_id": result.inserted_id,"error":None} # Return the inserted ID
|
15 |
except pymongo.errors.DuplicateKeyError:
|
16 |
# Handle the case where a document with the same 'hashed_doc' already exists
|
17 |
return {"error": "Document with this 'hashed_doc' already exists"}
|