Skip to content

Commit

Permalink
Fix issue flagged during code scanning.
Browse files Browse the repository at this point in the history
---------------------------
The test code for the get_organisation_stats function passed the year parameter as "None" in the test case.
A code scanning alert was raised because the year argument expects an integer in this method.
  • Loading branch information
Aadesh-Baral committed May 2, 2023
1 parent bcdd722 commit bccf821
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/services/organisation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ def get_projects_by_organisation_id(organisation_id: int) -> Organisation:
return projects

@staticmethod
def get_organisation_stats(organisation_id: int, year: int) -> OrganizationStatsDTO:
def get_organisation_stats(
organisation_id: int, year: int = None
) -> OrganizationStatsDTO:
projects = db.session.query(
Project.id, Project.status, Project.last_updated, Project.created
).filter(Project.organisation_id == organisation_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_get_organisation_stats(self):
test_project.status = ProjectStatus.PUBLISHED.value
test_project.save()
# Act
org_stats = OrganisationService.get_organisation_stats(self.test_org.id, None)
org_stats = OrganisationService.get_organisation_stats(self.test_org.id)
# Assert
self.assertEqual(org_stats.projects.published, 1)
self.assertEqual(org_stats.projects.draft, 0)
Expand Down

0 comments on commit bccf821

Please sign in to comment.