Skip to content

Commit

Permalink
Task dto last updated attribute made timezone aware and add teams by …
Browse files Browse the repository at this point in the history
…organisation manager fixed
  • Loading branch information
prabinoid committed Nov 4, 2024
1 parent eb9c68d commit 4d4efec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions backend/models/postgis/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
)
from sqlalchemy.orm import relationship
from sqlalchemy.orm.exc import MultipleResultsFound
from datetime import timezone

from backend.db import Base, get_session
from backend.exceptions import NotFound
Expand Down Expand Up @@ -1357,7 +1358,6 @@ async def reset_lock(
comment=comment,
db=db,
)

# Update task lock history with duration
await TaskHistory.update_task_locked_with_duration(
task_id=task_id,
Expand Down Expand Up @@ -1737,7 +1737,11 @@ async def as_dto_with_instructions(

task_history.append(history)

last_updated = task_history[0].action_date if task_history else None
last_updated = (
task_history[0].action_date.replace(tzinfo=timezone.utc).isoformat()
if task_history
else None
)
task_dto = await Task.as_dto(task_id, project_id, db, last_updated)
per_task_instructions = await Task.get_per_task_instructions(
task_id, project_id, preferred_locale, db
Expand Down
3 changes: 2 additions & 1 deletion backend/services/team_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,8 @@ async def is_user_team_manager(team_id: int, user_id: int, db: Database) -> bool

# Org admin manages teams attached to their org
user_managed_orgs = [
org.id for org in await OrganisationService.get_organisations(user_id, db)
org.organisation_id
for org in await OrganisationService.get_organisations(user_id, db)
]
if team.organisation_id in user_managed_orgs:
return True
Expand Down

0 comments on commit 4d4efec

Please sign in to comment.