feat:feature-team-productivity-dashboard
What does this MR do?
This merge request fixes broken imports and function mismatches in the team analytics module and ensures that team and user productivity statistics (commits, merge requests, and issues) are correctly computed and displayed.
Motivation / Use Case
This feature is essential for generating team productivity analytics in GitLab compliance tracking.
It allows:
- Monitoring commit activity
- Tracking merge request contributions
- Analyzing issue participation
at both individual and team levels, enabling better evaluation of contributor engagement
Implementation Notes
Approach Taken
- Identified incorrect imports in
team_analytics.py. - Replaced broken function references with correct existing function names.
- Ensured consistent naming across modules.
- Tested functionality using a live GitLab API token.
Key Design Decisions
- Maintained backward compatibility by reusing existing module functions.
- Avoided introducing new APIs or breaking changes.
Breaking Changes / Compatibility
-
❌ No breaking changes. -
✅ Fully backward compatible.
How to Test
Setup Steps
-
Pull this branch.
-
Activate virtual environment:
source venv/bin/activate
-
Ensure
.envcontains:GITLAB_TOKEN=your_token_here
Run Test Commands
python
from dotenv import load_dotenv
import os
from gitlab_utils.client import GitLabClient
from gitlab_utils.team_analytics import get_teams, get_team_stats
load_dotenv()
client = GitLabClient("https://code.swecha.org", os.getenv("GITLAB_TOKEN"))
teams = get_teams(client)
print("Total teams:", len(teams))
team = teams[0]
member_stats, team_total = get_team_stats(client, team.id)
print("Members:", list(member_stats.keys()))
print("Team totals:", team_total)
Expected Result
- Team list loads successfully.
- Team statistics are displayed without any errors.
Checklist
-
Feature is documented (in README or relevant doc files) -
Code is clean, readable, and follows the project style -
No breaking changes (or documented if there are) -
Tests are added or updated -
Feature works as intended in local testing