Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updated category based on the available yaml file #802

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import segno
import shapely.wkb as wkblib
import sqlalchemy
import pkg_resources
from fastapi import File, HTTPException, UploadFile
from geoalchemy2.shape import from_shape
from geojson import dump
Expand Down Expand Up @@ -1044,9 +1045,15 @@ def read_xlsforms(
):
"""Read the list of XLSForms from the disk."""
xlsforms = list()
package_name = "osm_fieldwork"
for xls in os.listdir(directory):
if xls.endswith(".xls") or xls.endswith(".xlsx"):
xlsforms.append(xls)
file_name = xls.split(".")[0]
yaml_file_name = f"data_models/{file_name}.yaml"
if pkg_resources.resource_exists(package_name,yaml_file_name):
xlsforms.append(xls)
else:
continue
log.info(xls)
inspect(db_models.DbXForm)
forms = table(
Expand Down