diff --git a/app.py b/app.py index 234fc62..f71cc35 100644 --- a/app.py +++ b/app.py @@ -130,7 +130,7 @@ async def result(request: Request, scale_id: str, db: Session = Depends(get_db)) scale_id=scale_id, user_agent=request.headers.get("user-agent", "Unknown"), ip_address=ip, - location=json.dumps(location) if location else None, + location=location, raw_response=dict(form_data), sum_response=responses, avg_response=average diff --git a/database.py b/database.py index 2488466..47c6c34 100644 --- a/database.py +++ b/database.py @@ -15,13 +15,13 @@ SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) Base = declarative_base() -class RawResponse(Base): +class Response(Base): __tablename__ = "responses" id = Column(Integer, primary_key=True, index=True) scale_id = Column(String, index=True) user_agent = Column(String) ip_address = Column(String) - location = Column(String) + location = Column(JSON) raw_response = Column(JSON) sum_response = Column(JSON) avg_response = Column(JSON)