Skip to content

Commit

Permalink
fix(backend): get total_tasks count on single project response
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Jan 10, 2025
1 parent f826ef1 commit d717337
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/backend/app/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,6 @@ class DbProject(BaseModel):
custom_tms_url: Optional[str] = None
status: Optional[ProjectStatus] = None
visibility: Optional[ProjectVisibility] = None
total_tasks: Optional[int] = None
xform_category: Optional[str] = None
odk_form_id: Optional[str] = None
xlsform_content: Optional[bytes] = None
Expand Down Expand Up @@ -1127,7 +1126,8 @@ async def one(cls, db: Connection, project_id: int, minimal: bool = False) -> Se
)
-- Required filter if the task array is empty
) FILTER (WHERE tasks.id IS NOT NULL), '[]'::json
) AS tasks
) AS tasks,
COUNT(tasks.id) AS total_tasks
FROM
projects p
-- For org name, logo, and ODK credentials
Expand Down

0 comments on commit d717337

Please sign in to comment.