Spaces:
Sleeping
Sleeping
Update modules/database/semantic_mongo_db.py
Browse files
modules/database/semantic_mongo_db.py
CHANGED
|
@@ -96,7 +96,7 @@ def get_student_semantic_analysis(username, limit=10):
|
|
| 96 |
try:
|
| 97 |
collection = get_collection(COLLECTION_NAME)
|
| 98 |
if not collection:
|
| 99 |
-
logger.error("No se pudo obtener la colecci贸n")
|
| 100 |
return []
|
| 101 |
|
| 102 |
query = {
|
|
@@ -108,18 +108,17 @@ def get_student_semantic_analysis(username, limit=10):
|
|
| 108 |
projection = {
|
| 109 |
"timestamp": 1,
|
| 110 |
"concept_graph": 1,
|
| 111 |
-
"_id": 1
|
| 112 |
}
|
| 113 |
|
| 114 |
-
cursor = collection.find(
|
| 115 |
-
query,
|
| 116 |
-
projection=projection
|
| 117 |
-
).sort("timestamp", -1)
|
| 118 |
|
| 119 |
if limit:
|
| 120 |
cursor = cursor.limit(limit)
|
| 121 |
-
|
| 122 |
-
|
|
|
|
|
|
|
| 123 |
|
| 124 |
except Exception as e:
|
| 125 |
logger.error(f"Error recuperando an谩lisis sem谩ntico: {str(e)}")
|
|
|
|
| 96 |
try:
|
| 97 |
collection = get_collection(COLLECTION_NAME)
|
| 98 |
if not collection:
|
| 99 |
+
logger.error("No se pudo obtener la colecci贸n semantic")
|
| 100 |
return []
|
| 101 |
|
| 102 |
query = {
|
|
|
|
| 108 |
projection = {
|
| 109 |
"timestamp": 1,
|
| 110 |
"concept_graph": 1,
|
| 111 |
+
"_id": 1
|
| 112 |
}
|
| 113 |
|
| 114 |
+
cursor = collection.find(query, projection).sort("timestamp", -1)
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
if limit:
|
| 117 |
cursor = cursor.limit(limit)
|
| 118 |
+
|
| 119 |
+
result = list(cursor)
|
| 120 |
+
logger.info(f"Recuperados {len(result)} an谩lisis sem谩nticos")
|
| 121 |
+
return result
|
| 122 |
|
| 123 |
except Exception as e:
|
| 124 |
logger.error(f"Error recuperando an谩lisis sem谩ntico: {str(e)}")
|