Skip to content

Commit

Permalink
Merge pull request #1028 from hotosm/minor-fixes
Browse files Browse the repository at this point in the history
Retriving model attribute directly.
  • Loading branch information
nrjadkry authored Dec 6, 2023
2 parents bbe5f5d + a756dfd commit d7351c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/backend/app/tasks/tasks_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ def get_centroid_from_outline(cls, v: Any, info: ValidationInfo) -> str:
def get_lock_uid(cls, v: int, info: ValidationInfo) -> str:
"""Get lock uid from lock_holder details."""
if lock_holder := info.data.get("lock_holder"):
return lock_holder.get("id")
return lock_holder.id
return None

@field_validator("locked_by_username", mode="before")
@classmethod
def get_lock_username(cls, v: str, info: ValidationInfo) -> str:
"""Get lock username from lock_holder details."""
if lock_holder := info.data.get("lock_holder"):
return lock_holder.get("username")
return lock_holder.username
return None


Expand Down

0 comments on commit d7351c7

Please sign in to comment.