Skip to content

Commit

Permalink
fix(backend): allow empty task id and osm id for new geopoint (#1774)
Browse files Browse the repository at this point in the history
* fix: allow empty task id and osm id for new geopoint

* fix: no need to check updatedat for submission count

* fix: task_id will be populated from form so it won't be null

* refactor: check if osm_id is empty str

---------

Co-authored-by: sujanadh <sujanadh07@gmail.com>
  • Loading branch information
Sujanadh and sujanadh authored Sep 11, 2024
1 parent 8cc8e14 commit 609f95f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/backend/app/central/central_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,12 @@ async def get_entities_data(

# Rename '__id' to 'id'
flattened_dict["id"] = flattened_dict.pop("__id")

# convert empty str osm_id to None
# when new entities are created osm_id will be empty
if flattened_dict.get("osm_id", "") == "":
flattened_dict["osm_id"] = None

all_entities.append(flattened_dict)

return all_entities
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/views/ProjectSubmissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ProjectSubmissions = () => {
const state = useAppSelector((state) => state.project);
const projectInfo = useAppSelector((state) => state.project.projectInfo);
const entityList = useAppSelector((state) => state.project.entityOsmMap);
const updatedEntities = entityList?.filter((entity) => entity?.updated_at && entity?.status > 1);
const updatedEntities = entityList?.filter((entity) => entity?.status > 1);

//Fetch project for the first time
useEffect(() => {
Expand Down

0 comments on commit 609f95f

Please sign in to comment.