Skip to content

Commit

Permalink
feat: submission form fields for the submision table
Browse files Browse the repository at this point in the history
  • Loading branch information
sujanadh committed Dec 29, 2023
1 parent 0a1c86a commit 6ce4b0b
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/backend/app/submission/submission_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from app.config import settings
from app.db import database
from app.projects import project_crud, project_schemas
from app.central import central_crud
from app.tasks import tasks_crud

from app.submission import submission_crud

Expand Down Expand Up @@ -332,4 +334,24 @@ async def get_submission_page(
submission_crud.update_submission_in_s3, db, project_id, background_task_id
)

return data
return data


@router.get("/submission_form_fields/{project_id}")
async def get_submission_form_fields(project_id: int, db: Session = Depends(database.get_db)):
"""
Retrieves the submission form for a specific project.
Args:
project_id (int): The ID of the project.
db (Session, optional): The database session. Defaults to Depends(database.get_db).
Returns:
Any: The response from the submission form API.
"""

project = await project_crud.get_project(db, project_id)
task_list = await tasks_crud.get_task_id_list(db, project_id)
odk_form = central_crud.get_odk_form(project)
response = odk_form.form_fields(project.odkid, str(task_list[0]))
return response

0 comments on commit 6ce4b0b

Please sign in to comment.