diff --git a/src/backend/app/central/central_crud.py b/src/backend/app/central/central_crud.py index 9fdec47cfb..02e4ef25a3 100644 --- a/src/backend/app/central/central_crud.py +++ b/src/backend/app/central/central_crud.py @@ -32,6 +32,7 @@ from osm_fieldwork.OdkCentral import OdkAppUser, OdkForm, OdkProject from pyxform.xls2xform import xls2xform_convert from sqlalchemy.orm import Session +from fastapi.responses import JSONResponse from ..config import settings from ..db import db_models @@ -365,10 +366,7 @@ async def test_form_validity(xform_content: str, form_type: str): xls2xform_convert(xlsform_path=xlsform_path, xform_path=outfile, validate=False) return {"message": "Your form is valid"} except Exception as e: - raise HTTPException( - status_code=400, - detail={"message": "Your form is invalid", "possible_reason": str(e)}, - ) + return JSONResponse(content={"message":"Your form is invalid", "possible_reason":str(e)}, status_code=400) def generate_updated_xform( diff --git a/src/backend/app/projects/project_crud.py b/src/backend/app/projects/project_crud.py index ad90019930..4d8dbfdc77 100644 --- a/src/backend/app/projects/project_crud.py +++ b/src/backend/app/projects/project_crud.py @@ -1733,6 +1733,7 @@ def convert_to_project_summary(db_project: db_models.DbProject): summary.num_contributors = ( db_project.tasks_mapped + db_project.tasks_validated ) # TODO: get real number of contributors + summary.organisation_logo = db_project.organisation.logo if db_project.organisation else None return summary else: diff --git a/src/backend/app/projects/project_schemas.py b/src/backend/app/projects/project_schemas.py index 9ace427c8f..c82d527ba7 100644 --- a/src/backend/app/projects/project_schemas.py +++ b/src/backend/app/projects/project_schemas.py @@ -75,6 +75,7 @@ class ProjectSummary(BaseModel): tasks_bad: int = None hashtags: List[str] = None organisation_id: int = None + organisation_logo: str = None class Config: orm_mode = True