Exemplo n.º 1
0
 def testTeamMetricsChartContainsAllMetricsDataForMultipleSeries(self):
     self.env.compmgr.enabled[MetricsChartGenerator] = True
     today = now()
     self._add_metrics(self.sprint, **{Key.VELOCITY: 10})
     start_sprint2 = today - timedelta(days=30)
     sprint2 = self.teh.create_sprint(name='Sprint 2', start=start_sprint2, 
                                      duration=20, team=self.sprint.team)
     self._add_metrics(sprint2, **{Key.ESTIMATED_VELOCITY: 7})
     start_sprint3 = today - 2 * timedelta(days=30)
     sprint3 = self.teh.create_sprint(name='Sprint 3', start=start_sprint3,
                                      duration=20, team=self.sprint.team)
     self._add_metrics(sprint3, **{Key.VELOCITY: 5})
     self._add_metrics(sprint3, **{Key.ESTIMATED_VELOCITY: 9})
     
     widget = ChartGenerator(self.env).get_chartwidget(ChartType.TEAM_METRICS, 
                   team_name=self.sprint.team.name, metric_names=[Key.ESTIMATED_VELOCITY, Key.VELOCITY])
     self.assert_equals(['Sprint 3', 'Sprint 2', self.sprint.name], widget.data['sprint_names'])
     metrics = widget.data['metrics']
     self.assert_equals(2, len(metrics))
     
     velocity_label, velocity_data = metrics[0]
     self.assert_equals(get_label(Key.ESTIMATED_VELOCITY), velocity_label)
     self.assert_equals([(0, 9), (1, 7)], velocity_data)
     
     velocity_label, velocity_data = metrics[1]
     self.assert_equals(get_label(Key.VELOCITY), velocity_label)
     self.assert_equals([(0, 5), (2, 10)], velocity_data)
Exemplo n.º 2
0
 def _calculated_fields(self):
     for calculated_property_name in LinksConfiguration(
             self.env).get_calculated():
         calculated_field = dict(is_calculated=True,
                                 type='text',
                                 label=get_label(calculated_property_name))
         yield calculated_property_name, calculated_field
Exemplo n.º 3
0
 def _get_metrics_data(self, metric_names, sprint_names, metrics_by_sprint):
     metrics = []
     for label in metric_names:
         metric_values = []
         for i, sprint_name in enumerate(sprint_names):
             m = metrics_by_sprint[sprint_name]
             value = m[label]
             if value != None:
                 metric_values.append((i, value))
         metrics.append((get_label(label), metric_values))
     return metrics
Exemplo n.º 4
0
 def do_get(self, req):
     # Metrics is higher in the hierarchy
     from agilo.scrum.metrics import MetricsController
     
     add_stylesheet(req, "common/css/report.css")
     get_team = TeamController.GetTeamCommand(self.env, team=req.args['name'])
     team = self.controller.process_command(get_team)
     req.perm.assert_permission(Action.TEAM_VIEW, team.resource)
     
     cmd = MetricsController.ListMetricsCommand(self.env, team=team.name)
     metrics_by_sprint = MetricsController(self.env).process_command(cmd)
     
     available_metrics = self._get_available_metrics(metrics_by_sprint)
     data = {'team': team}
     data['chart_widgets'] = self._get_charts(req, team, available_metrics)
     data['metric_labels'] = [get_label(m) for m in available_metrics]
     data['metric_names'] = available_metrics
     data['sprints'] = self._format_sprint_and_metrics(req, metrics_by_sprint,
                                                       available_metrics, team)
     return data
Exemplo n.º 5
0
 def _make_title(self, metric_names):
     titles = []
     for name in metric_names:
         titles.append(get_label(name))
     return ' / '.join(titles)
Exemplo n.º 6
0
 def _calculated_fields(self):
     for calculated_property_name in LinksConfiguration(self.env).get_calculated():
         calculated_field = dict(is_calculated=True, type='text', label=get_label(calculated_property_name))
         yield calculated_property_name, calculated_field