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

Fix unable to reactivate deactivated works #2336

Merged
merged 1 commit into from
Jun 17, 2024
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
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
Loading