Skip to content

Commit

Permalink
Merge pull request #802 from Sujanadh/fix-xlsforms
Browse files Browse the repository at this point in the history
fix: updated category based on the available yaml file
  • Loading branch information
robsavoye authored Sep 6, 2023
2 parents 6e9707f + 5fb445d commit 098e2ec
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 098e2ec

Please sign in to comment.