File size: 1,305 Bytes
12ffa62
 
 
 
 
 
 
 
 
0a09d3c
 
12ffa62
0a09d3c
12ffa62
 
0a09d3c
 
 
 
12ffa62
 
0a09d3c
 
 
 
12ffa62
 
0a09d3c
 
 
 
12ffa62
 
 
0a09d3c
12ffa62
 
 
0a09d3c
12ffa62
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# modules/database/current_situation_mongo_db.py

from datetime import datetime, timezone
import logging
from .mongo_db import get_collection, insert_document, find_documents

logger = logging.getLogger(__name__)
COLLECTION_NAME = 'student_current_situation'

# En modules/database/current_situation_mongo_db.py
def store_current_situation_result(username, text, metrics, feedback):
    """
    Guarda los resultados del an谩lisis de situaci贸n actual.
    """
    try:
        collection = get_collection('student_current_situation')
        
        # Crear documento
        document = {
            'username': username,
            'timestamp': datetime.now(timezone.utc).isoformat(),
            'text': text,
            'metrics': metrics,
            'feedback': feedback,
            'analysis_type': 'current_situation'
        }
        
        # Insertar documento
        result = collection.insert_one(document)
        
        if result.inserted_id:
            logger.info(f"An谩lisis de situaci贸n actual guardado para {username}")
            return True
            
        logger.error("No se pudo insertar el documento")
        return False
        
    except Exception as e:
        logger.error(f"Error guardando an谩lisis de situaci贸n actual: {str(e)}")
        return False