scripts/burndowndata.py in trollolo-0.0.8 vs scripts/burndowndata.py in trollolo-0.0.9

- old
+ new

@@ -7,18 +7,16 @@ def __init__(self, args): self.args = args burndown = self.readYAML(self.args.sprint) self.getSprintData(burndown) - self.calculateMaxStoryPoints() - self.calculateMaxTasks() self.setBonusTasksDayOne(burndown) self.setUnplannedTasksDayOne(burndown) self.setExtraDays() self.setUnplannedDays() - self.calculateYRange(self.max_story_points, self.bonus_tasks_done, self.bonus_story_points_done, self.unplanned_tasks_done, self.unplanned_story_points_done) - self.setScaleFactor(self.max_tasks, self.max_story_points) + self.calculateYRange(self.total_story_points[0], self.bonus_tasks_done, self.bonus_story_points_done, self.unplanned_tasks_done, self.unplanned_story_points_done) + self.setScaleFactor(self.total_tasks[0], self.total_story_points[0]) def readYAML(self, sprint_number): with open('burndown-data-' + sprint_number + '.yaml', 'r') as f: burndown = yaml.load(f) return burndown @@ -47,12 +45,10 @@ self.unplanned_tasks_done = [] self.x_fast_lane = [] self.y_fast_lane = [] self.total_fast_lane = [] self.total_unplanned_fast_lane = [] - self.max_story_points = 0 - self.max_tasks = 0 for day in burndown["days"]: self.days.append(self.current_day) self.open_story_points.append(day["story_points"]["open"]) self.total_story_points.append(day["story_points"]["total"]) @@ -92,30 +88,20 @@ self.total_unplanned_fast_lane.append(0) self.current_day += 1 return - def calculateMaxStoryPoints(self): - for sp in self.total_story_points: - self.max_story_points = max(self.max_story_points, sp) - return - - def calculateMaxTasks(self): - for t in self.total_tasks: - self.max_tasks = max(self.max_tasks, t) - return - def setBonusTasksDayOne(self, burndown): if burndown["days"][0].has_key("tasks_extra"): self.bonus_tasks_day_one = burndown["days"][0]["tasks_extra"]["done"] else: self.bonus_tasks_day_one = 0 return def setUnplannedTasksDayOne(self, burndown): if burndown["days"][0].has_key("unplanned_tasks"): - self.unplanned_tasks_day_one = burndown["days"][0]["unplanned_tasks"]["done"] + self.unplanned_tasks_day_one = burndown["days"][0]["unplanned_tasks"]["total"] - burndown["days"][0]["unplanned_tasks"]["open"] else: self.unplanned_tasks_day_one = 0 return def setExtraDays(self): @@ -138,12 +124,12 @@ self.unplanned_tasks_days = [self.unplanned_tasks_days[0] - 1] + self.unplanned_tasks_days self.unplanned_tasks_done = [0] + self.unplanned_tasks_done self.unplanned_day = 1 return - def calculateYRange(self, max_story_points, bonus_tasks_done, bonus_story_points_done, unplanned_tasks_done, unplanned_story_points_done): - self.ymax = max_story_points + 3 + def calculateYRange(self, total_story_points, bonus_tasks_done, bonus_story_points_done, unplanned_tasks_done, unplanned_story_points_done): + self.ymax = total_story_points + 3 if len(bonus_tasks_done) > 0: ymin_bonus_tasks = min(bonus_tasks_done) -3 else: ymin_bonus_tasks = 0 @@ -166,9 +152,9 @@ self.ymin = min(ymin_bonus_tasks, ymin_bonus_story_points, ymin_unplanned_tasks, ymin_unplanned_story_points) if self.ymin > -3: self.ymin = -3 return - def setScaleFactor(self, max_tasks, max_story_points): - self.scalefactor = float(max_tasks) / float(max_story_points) + def setScaleFactor(self, total_tasks, total_story_points): + self.scalefactor = float(total_tasks) / float(total_story_points) return