Add symptoms attribute and boolean/string parsing

This commit is contained in:
coolneng 2020-11-25 18:21:54 +01:00
parent 5ff70715c8
commit 23d7bc0f7a
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 21 additions and 3 deletions

View File

@ -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 ""
return "No"

View File

@ -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)