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

Replaced direct use of Repo code with Service code #505

Merged
merged 5 commits into from
Aug 9, 2024
Merged
Changes from 1 commit
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
Next Next commit
Replaced direct use of Repo code with Service code
Kamlesh72 committed Aug 8, 2024
commit d3d176e0b9359138f3f61dc0ee2db878b5d21538
8 changes: 4 additions & 4 deletions backend/analytics_server/mhq/api/deployment_analytics.py
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
DeploymentFrequencyMetrics,
DeploymentType,
)
from mhq.store.repos.code import CodeRepoService
from mhq.service.code.repository_service import get_repository_service


app = Blueprint("deployment_analytics", __name__)
@@ -62,12 +62,12 @@ def get_team_deployment_analytics(
pr_filter: PRFilter = apply_pr_filter(
pr_filter, EntityType.TEAM, team_id, [SettingType.EXCLUDED_PRS_SETTING]
)
code_repo_service = CodeRepoService()
repository_service = get_repository_service()

team_repos: List[TeamRepos] = code_repo_service.get_active_team_repos_by_team_id(
team_repos: List[TeamRepos] = repository_service.get_active_team_repos_by_team_id(
team_id
)
org_repos: List[OrgRepo] = code_repo_service.get_active_org_repos_by_ids(
org_repos: List[OrgRepo] = repository_service.get_active_org_repos_by_ids(
[str(team_repo.org_repo_id) for team_repo in team_repos]
)

Original file line number Diff line number Diff line change
@@ -26,6 +26,12 @@ def get_team_repos(self, team: Team) -> List[OrgRepo]:
def get_team_repos_by_team(self, team: Team) -> List[TeamRepos]:
return self._code_repo_service.get_team_repos_by_team_id(team_id=str(team.id))

def get_active_team_repos_by_team_id(self, team_id: str) -> List[TeamRepos]:
return self._code_repo_service.get_active_team_repos_by_team_id(team_id)

def get_active_org_repos_by_ids(self, repo_ids: List[str]) -> List[OrgRepo]:
return self._code_repo_service.get_active_org_repos_by_ids(repo_ids)

def get_repo_id_team_repos_map(
self, team: Team, org_repos: List[OrgRepo]
) -> Dict[str, TeamRepos]: