Skip to content
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
3 changes: 1 addition & 2 deletions epictrack-api/src/api/resources/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,7 @@ class WorkFirstNations(Resource):
def get(work_id):
"""Get all the active first nations allocated to the work"""
req.WorkIdPathParameterSchema().load(request.view_args)
args = req.BasicRequestQueryParameterSchema().load(request.args)
first_nations = WorkService.find_first_nations(work_id, args.get("is_active"))
first_nations = WorkService.find_active_first_nations(work_id)
return (
res.WorkIndigenousNationResponseSchema(many=True).dump(first_nations),
HTTPStatus.OK,
Expand Down
8 changes: 3 additions & 5 deletions epictrack-api/src/api/services/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@ def generate_workplan(
return file_buffer.getvalue()

@classmethod
def find_first_nations(cls, work_id: int, is_active) -> List[IndigenousNation]:
"""Active first nations assigned on a work"""
def find_active_first_nations(cls, work_id: int) -> List[IndigenousNation]:
"""Find active first nations assigned on a work"""
query = (
db.session.query(IndigenousWork)
.join(
Expand All @@ -727,8 +727,6 @@ def find_first_nations(cls, work_id: int, is_active) -> List[IndigenousNation]:
)
.order_by(IndigenousNation.name)
)
if is_active is not None:
query = query.filter(IndigenousWork.is_active.is_(is_active))
return query.all()

@classmethod
Expand Down Expand Up @@ -840,7 +838,7 @@ def generate_first_nations_excel(
): # pylint: disable=unsupported-assignment-operation,unsubscriptable-object
"""Generate the workplan excel file for given work and phase"""
cls._check_can_edit_or_team_member_auth(work_id)
first_nations = cls.find_first_nations(work_id, None)
first_nations = cls.find_active_first_nations(work_id)
schema = WorkFirstNationSchema(many=True)
data = schema.dump(first_nations)

Expand Down