def analyze_sprint_lag(self, start_date, end_date): squad_sprint_counts = defaultdict(list) squad_sprint_story_point_sum = defaultdict(float) squad_story_point_sum = defaultdict(float) squad_bugs = defaultdict(int) issues = self.get_issues(self.get_issue_query(start_date, end_date)) for issue in issues: squad = self.get_squad(issue) try: num_sprints = len(getattr(issue.fields, self.sprint_field)) except: num_sprints = 0 story_points = get_or_float_zero(issue.fields, self.story_point_field) issue_type = self.get_issue_type(issue) # Has a squad and was actually done via sprint process if squad and num_sprints > 0 and issue_type == 'story': squad_sprint_counts[squad].append(num_sprints) if story_points > 0: squad_sprint_story_point_sum[ squad] += num_sprints * story_points squad_story_point_sum[squad] += story_points if issue_type == 'bug': squad_bugs[squad] += 1 logger.info('Squad\tSprint Lag\tSP Sprint Lag\tBugs') for squad, counts in squad_sprint_counts.items(): logger.info( '%s\t%s\t%s\t%s', squad, sum(counts) * 1.0 / len(counts), squad_sprint_story_point_sum[squad] / squad_story_point_sum[squad], squad_bugs[squad])
def analyze_story_points(self, start_date, end_date): user_story_point_sum = Counter() user_bugs = defaultdict(int) issues = self.get_issues(self.get_issue_query(start_date, end_date)) for issue in issues: story_points = get_or_float_zero(issue.fields, self.story_point_field) assignee = issue.fields.assignee if issue.fields.assignee else 'None' user_story_point_sum.update({assignee: int(story_points)}) if self.get_issue_type(issue) == 'bug': user_bugs[assignee] += 1 logger.info('User\tSP\tBugs') for user, story_points in user_story_point_sum.most_common(100): logger.info('%s\t%s\t%s', user, story_points, user_bugs[user])
def analyze_story_points(self, start_date, end_date): user_story_point_sum = Counter() user_data = {} issues = self.get_issues(self.get_issue_query(start_date, end_date)) for issue in issues: story_points = get_or_float_zero(issue.fields, self.story_point_field) assignee = str( issue.fields.assignee) if issue.fields.assignee else 'None' user_story_point_sum.update({assignee: int(story_points)}) if assignee not in user_data: user_data[assignee] = defaultdict(int) issue_type = self.get_issue_type(issue) user_data[assignee][issue_type + '_cnt'] += 1 user_data[assignee][issue_type + '_story_points'] += int(story_points) logger.info('User\tSP\tStories\tBugs') for user, story_points in user_story_point_sum.most_common(100): logger.info('%s\t%s\t%s', user, story_points, user_data[user])
def analyze_sprint_lag(self, start_date, end_date): team_sprint_counts = defaultdict(list) team_sprint_story_point_sum = defaultdict(float) team_story_point_sum = defaultdict(float) team_bugs = defaultdict(int) issues = self.get_issues(self.get_issue_query(start_date, end_date)) for issue in issues: team = self.get_team(issue) try: num_sprints = len(getattr(issue.fields, self.sprint_field)) except: num_sprints = 0 story_points = get_or_float_zero(issue.fields, self.story_point_field) issue_type = self.get_issue_type(issue) # Has a team and was actually done via sprint process if team and num_sprints > 0 and issue_type == "story": team_sprint_counts[team].append(num_sprints) if story_points > 0: team_sprint_story_point_sum[ team] += num_sprints * story_points team_story_point_sum[team] += story_points if issue_type == "bug": team_bugs[team] += 1 logger.info("Team\tSprint Lag\tSP Sprint Lag\tBugs") for team, counts in team_sprint_counts.items(): if team_sprint_story_point_sum[team] > 0: logger.info( "%s\t%s\t%s\t%s", team, sum(counts) * 1.0 / len(counts), team_sprint_story_point_sum[team] / team_story_point_sum[team], team_bugs[team], ) else: logger.info("%s\tNA\t%NA\t%s", team, team_bugs[team])
def get_story_points(self, issue): return get_or_float_zero(issue.fields, self.story_point_field)