Skip to content

Commit

Permalink
Fix unable to reactivate deactivated works (#2336)
Browse files Browse the repository at this point in the history
  • Loading branch information
jadmsaadaot authored Jun 17, 2024
1 parent 79ab763 commit 74127a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion epictrack-api/src/api/resources/work_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class EditIssues(Resource):
def patch(work_id, issue_id, update_id):
"""Approve a work status."""
request_dict = req.WorkIssuesUpdateEditSchema().load(API.payload)
edited_issue_update = WorkIssuesService.edit_issue_update(work_id, issue_id, update_id, request_dict)
edited_issue_update = WorkIssuesService.edit_issue_update(issue_id, update_id, request_dict)

return res.WorkIssueUpdatesResponseSchema().dump(edited_issue_update), HTTPStatus.OK

Expand Down
11 changes: 5 additions & 6 deletions epictrack-api/src/api/services/work_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ def find_all_work_issues(cls, work_id):
return work_issues

@classmethod
def find_work_issue_by_id(cls, work_id, issue_id):
def find_work_issue_by_id(cls, issue_id):
"""Find all status related to a work"""
results = WorkIssuesModel.find_by_params({"work_id": work_id, "id": issue_id})
return results[0] if results else None
return WorkIssuesModel.find_by_id(issue_id)

@classmethod
def find_work_issues_by_work_ids(cls, work_ids):
Expand Down Expand Up @@ -132,7 +131,7 @@ def _check_valid_issue_edit_data(cls, new_data, work_issue_db):
@classmethod
def edit_issue(cls, work_id, issue_id, issue_data):
"""Edit an existing work issue, and save it only if there are changes."""
work_issue = WorkIssuesService.find_work_issue_by_id(work_id, issue_id)
work_issue = WorkIssuesService.find_work_issue_by_id(issue_id)

if not work_issue:
raise ResourceNotFoundError("Work issue doesnt exist")
Expand Down Expand Up @@ -160,9 +159,9 @@ def _check_edit_auth(cls, work_id):
authorisation.check_auth(one_of_roles=one_of_roles, work_id=work_id)

@classmethod
def edit_issue_update(cls, work_id, issue_id, issue_update_id, issue_update_data):
def edit_issue_update(cls, issue_id, issue_update_id, issue_update_data):
"""Edit an existing work issue update."""
work_issue = WorkIssuesService.find_work_issue_by_id(work_id, issue_id)
work_issue = WorkIssuesService.find_work_issue_by_id(issue_id)

if not work_issue:
raise ResourceNotFoundError("Work issue doesnt exist")
Expand Down

0 comments on commit 74127a9

Please sign in to comment.