Skip to content

Commit

Permalink
run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sujanadh committed Jan 19, 2024
1 parent 5c77431 commit 9c5dad0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
18 changes: 18 additions & 0 deletions src/backend/app/submissions/submission_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,24 @@ async def get_submissions_by_date(


async def get_submission_by_project(project_id: int, skip: 0, limit: 100, db: Session):
"""Get submission by project.
Retrieves a paginated list of submissions for a given project.
Args:
project_id (int): The ID of the project.
skip (int): The number of submissions to skip.
limit (int): The maximum number of submissions to retrieve.
db (Session): The database session.
Returns:
Tuple[int, List]: A tuple containing the total number of submissions and
the paginated list of submissions.
Raises:
ValueError: If the submission file cannot be found.
"""
project = await project_crud.get_project(db, project_id)
s3_project_path = f"/{project.organisation_id}/{project_id}"
s3_submission_path = f"/{s3_project_path}/submission.zip"
Expand Down
21 changes: 17 additions & 4 deletions src/backend/app/submissions/submission_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,23 @@ async def submission_table(
results_per_page: int = Query(13, le=100),
db: Session = Depends(database.get_db),
):
"""This api returns the submission table of a project.
It takes two parameter: project_id and task_id.
project_id: The ID of the project. This endpoint returns the submission table of this project.
task_id: The ID of the task. This endpoint returns the submission table of this task.
"""This API returns the submission table of a project.
Args:
background_tasks (BackgroundTasks): The background tasks manager.
project_id (int): The ID of the project.
page (int, optional): The page number for pagination. Defaults to 1.
results_per_page (int, optional): The number of results per page for pagination.
Defaults to 13.
db (Session, optional): The database session.
Returns:
PaginatedSubmissions: The paginated submission table of the project.
"""
skip = (page - 1) * results_per_page
limit = results_per_page
Expand Down
2 changes: 2 additions & 0 deletions src/backend/app/submissions/submission_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ class PaginationInfo(BaseModel):


class PaginatedSubmissions(BaseModel):
"""Paginated Submissions."""

results: List
pagination: PaginationInfo

0 comments on commit 9c5dad0

Please sign in to comment.