Skip to content

Commit

Permalink
updated task wise submission api for project info
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry authored and spwoodcock committed Oct 9, 2023
1 parent bc03300 commit 9779950
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/backend/app/central/central_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ def delete_odk_xform(
return result


# def list_odk_xforms(project_id: int, odk_central: project_schemas.ODKCentral = None):
def list_odk_xforms(
project_id: int,
odk_central: project_schemas.ODKCentral = None,
Expand Down
19 changes: 8 additions & 11 deletions src/backend/app/tasks/tasks_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,18 @@ async def task_features_count(
# Assemble the final data list
data = []
for x in odk_details:
feature_count_query = text(
f"""
feature_count_query = f"""
select count(*) from features where project_id = {project_id} and task_id = {x['xmlFormId']}
"""
)

result = db.execute(feature_count_query)
feature_count = result.fetchone()

data.append(
{
"task_id": x["xmlFormId"],
"submission_count": x["submissions"],
"last_submission": x["lastSubmission"],
"feature_count": feature_count[0],
}
)
data.append({
'task_id': x['xmlFormId'],
'submission_count': x['submissions'],
'last_submission': x['lastSubmission'],
'feature_count': feature_count['count']
})

return data

0 comments on commit 9779950

Please sign in to comment.