diff --git a/src/backend/app/projects/project_crud.py b/src/backend/app/projects/project_crud.py index b1cdbbb971..f83ead8376 100644 --- a/src/backend/app/projects/project_crud.py +++ b/src/backend/app/projects/project_crud.py @@ -55,7 +55,7 @@ shape, ) from shapely.ops import unary_union -from sqlalchemy import and_, column, inspect, select, table, text +from sqlalchemy import and_, column, func, inspect, select, table, text from sqlalchemy.dialects.postgresql import insert from sqlalchemy.orm import Session @@ -147,7 +147,6 @@ async def get_project_by_id(db: Session, project_id: int): db_project = ( db.query(db_models.DbProject) .filter(db_models.DbProject.id == project_id) - .order_by(db_models.DbProject.id) .first() ) return await convert_to_app_project(db_project) @@ -578,7 +577,7 @@ async def get_data_extract_from_osm_rawdata( return data_extract except Exception as e: log.error(e) - raise HTTPException(status_code=400, detail=str(e)) + raise HTTPException(status_code=400, detail=str(e)) from e async def get_data_extract_url( @@ -628,7 +627,7 @@ async def get_data_extract_url( shape(feature.get("geometry")) for feature in aoi.get("features", []) ] merged_geom = unary_union(geometries) - elif geom_type := aoi.get("type") == "Feature": + elif geom_type == aoi.get("type") == "Feature": merged_geom = shape(aoi.get("geometry")) else: merged_geom = shape(aoi) @@ -2336,15 +2335,13 @@ def is_valid_coordinate(coord): else input_geojson.get("geometry", {}).get("type", "") ) if geometry_type == "MultiPolygon": - first_coordinate = ( - coordinates[0][0] if coordinates and coordinates[0] else None - ) + first_coordinate = coordinates[0][0] if coordinates and coordinates[0] else None elif geometry_type == "Point": first_coordinate = coordinates if coordinates else None elif geometry_type == "LineString": first_coordinate = coordinates[0] if coordinates else None - + else: first_coordinate = coordinates[0][0] if coordinates else None @@ -2440,7 +2437,9 @@ async def get_project_users(db: Session, project_id: int): project_id (int): The ID of the project. Returns: - List[Dict[str, Union[str, int]]]: A list of dictionaries containing the username and the number of contributions made by each user for the specified project. + List[Dict[str, Union[str, int]]]: A list of dictionaries containing + the username and the number of contributions made by each user + for the specified project. """ contributors = ( db.query(db_models.DbTaskHistory) @@ -2470,7 +2469,8 @@ def count_user_contributions(db: Session, user_id: int, project_id: int) -> int: project_id (int): The ID of the project. Returns: - int: The number of contributions made by the user for the specified project. + int: The number of contributions made by the user for the specified + project. """ contributions_count = ( db.query(func.count(db_models.DbTaskHistory.user_id)) diff --git a/src/frontend/src/components/createproject/ProjectDetailsForm.tsx b/src/frontend/src/components/createproject/ProjectDetailsForm.tsx index 36337f1f62..1003d4bb6c 100755 --- a/src/frontend/src/components/createproject/ProjectDetailsForm.tsx +++ b/src/frontend/src/components/createproject/ProjectDetailsForm.tsx @@ -25,10 +25,6 @@ const ProjectDetailsForm: React.FC = () => { const organizationListData: any = useAppSelector((state) => state.createproject.organizationList); //we use use selector from redux to get all state of projectDetails from createProject slice - useEffect(() => { - // dispatch(OrganisationService(`${import.meta.env.VITE_API_URL}/organization/`)); - }, []); - const submission = () => { // submitForm(); dispatch(CreateProjectActions.SetIndividualProjectDetailsData(values));