mirror of
				https://gitlab.com/akasroua/covot
				synced 2025-11-04 02:39:50 +01:00 
			
		
		
		
	Add symptoms attribute and boolean/string parsing
This commit is contained in:
		
							parent
							
								
									5ff70715c8
								
							
						
					
					
						commit
						23d7bc0f7a
					
				@ -56,3 +56,20 @@ def verify_code(id, code) -> bool:
 | 
			
		||||
    if valid_code:
 | 
			
		||||
        return True
 | 
			
		||||
    return False
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def parse_boolean_string(value) -> bool:
 | 
			
		||||
    """
 | 
			
		||||
    Converts string response to a boolean
 | 
			
		||||
    """
 | 
			
		||||
    mapping = {r"[S-s][i-í]": True, r"[N-n]o": False}
 | 
			
		||||
    return mapping[value]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def boolean_to_string(value) -> str:
 | 
			
		||||
    """
 | 
			
		||||
    Converts boolean to string
 | 
			
		||||
    """
 | 
			
		||||
    if value:
 | 
			
		||||
        return "Sí"
 | 
			
		||||
    return "No"
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
from sqlalchemy import Column
 | 
			
		||||
from sqlalchemy.types import Date, Integer, String, Text
 | 
			
		||||
from sqlalchemy.types import Boolean, Date, Integer, String, Text
 | 
			
		||||
 | 
			
		||||
from database import Base
 | 
			
		||||
 | 
			
		||||
@ -15,8 +15,9 @@ class User(Base):
 | 
			
		||||
    numero_de_documento = Column(String, nullable=False, unique=True)
 | 
			
		||||
    centro_academico = Column(String, nullable=False)
 | 
			
		||||
    correo_institucional = Column(String, nullable=False, unique=True)
 | 
			
		||||
    tipo_alojamiento = Column(String)
 | 
			
		||||
    tipo_caso = Column(String)
 | 
			
		||||
    tipo_alojamiento = Column(Integer)
 | 
			
		||||
    tipo_caso = Column(Integer)
 | 
			
		||||
    sintomas = Column(Boolean)
 | 
			
		||||
    comienzo_aislamiento = Column(Date)
 | 
			
		||||
    fin_aislamiento = Column(Date)
 | 
			
		||||
    observaciones = Column(Text)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user