Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception handling for no submissions meta #1069

Merged
merged 2 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -2398,9 +2398,11 @@ async def get_dashboard_detail(project_id: int, db: Session):

s3_project_path = f"/{project.organisation_id}/{project_id}"
s3_submission_path = f"/{s3_project_path}/submissions.meta.json"

file = get_obj_from_bucket(settings.S3_BUCKET_NAME, s3_submission_path)
project.last_active = (json.loads(file.getvalue()))["last_submission"]
try:
file = get_obj_from_bucket(settings.S3_BUCKET_NAME, s3_submission_path)
project.last_active = (json.loads(file.getvalue()))["last_submission"]
except ValueError:
pass

contributors = db.query(db_models.DbTaskHistory).filter(db_models.DbTaskHistory.project_id==project_id).all()
unique_user_ids = {user.user_id for user in contributors if user.user_id is not None}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/app/projects/project_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ProjectBase(BaseModel):
author: User
project_info: ProjectInfo
status: ProjectStatus
# location_str: str
location_str: str
outline_geojson: Optional[GeojsonFeature] = None
project_tasks: Optional[List[tasks_schemas.Task]]
xform_title: Optional[str] = None
Expand Down
Loading