Ejemplo n.º 1
0
    def test_remaining_time_correct_even_for_closed_stories(self):
        self.sprint.start = datetime.today() - timedelta(days=5)
        self.sprint.save()

        # Store some remaining time for yesterday
        yesterday_midnight = datetime.combine(yesterday(tz=utc),
                                              time(tzinfo=utc))
        RemainingTime(self.env,
                      self.task1).set_remaining_time(3, yesterday_midnight)
        RemainingTime(self.env,
                      self.task2).set_remaining_time(1, yesterday_midnight)

        self._close_ticket_as_fixed(self.task1)
        self._close_ticket_as_fixed(self.task2)
        self._close_ticket_as_fixed(self.story1)

        remaining_times = self.get_remaining_times(self.sprint.name,
                                                   cut_to_today=True)
        # We have to use relative positioning from the end because we don't know
        # if the sprint will be extended due to a holiday.
        self.assert_equals([4, 0], remaining_times[-2:])

        # Check that the same holds true for retrieving a single day
        remaining_time = self.get_total_remaining_time(self.sprint.name,
                                                       yesterday_midnight)
        self.assert_equals(4, remaining_time)
Ejemplo n.º 2
0
 def test_can_calculate_remaining_time_for_a_specific_day(self):
     # Set remaining time for tasks at the end of the sprint
     sprint = self.sprint
     end = sprint.end
     rt1 = RemainingTime(self.env, self.task1)
     rt2 = RemainingTime(self.env, self.task2)
     rt1.set_remaining_time(2, day=end)
     rt2.set_remaining_time(1, day=end)
     self.assert_equals(
         2,
         RemainingTime(self.env, self.task1).get_remaining_time(end))
     self.assert_equals(
         1,
         RemainingTime(self.env, self.task2).get_remaining_time(end))
     self.assert_equals(3, self.get_total_remaining_time(sprint.name, end))
Ejemplo n.º 3
0
 def _get_remaining_time_series_for_task(self, env, start, end, today,
                                         task, append_current_time,
                                         interval_duration):
     """Return the remaining time series for this task within the 
     specified interval. Today is the date of today so that his does not
     have to be computed every time (prevents tz-related errors)."""
     # TODO: Fixme - use some kind of ModelManager?
     from agilo.scrum import RemainingTime
     rt_store = RemainingTime(env, task)
     return self._get_remaining_time_series_for_ticket(
         start, end, today, rt_store.get_remaining_time,
         append_current_time, interval_duration)
Ejemplo n.º 4
0
 def test_include_remaining_time_from_unconnected_tasks(self):
     task_props = {
         Key.SPRINT: self.sprint.name,
         Key.REMAINING_TIME: "5",
         Key.OWNER: 'Foo'
     }
     orphan_task = self.teh.create_ticket(Type.TASK, task_props)
     day_before_yesterday = now(tz=utc) - timedelta(days=2)
     RemainingTime(self.env,
                   orphan_task).set_remaining_time(7, day_before_yesterday)
     self.assert_length(4, self.sprint_backlog)
     developers = self._get_resource_load_for_developers()
     dev = self.find_developer(developers, 'Foo')
     # Task2 is not used anymore
     self.assert_equals(5, dev.load[-1].remaining_time)
Ejemplo n.º 5
0
 def set_remaining_time(self, task, day, remaining):
     rt = RemainingTime(self.env, task)
     rt.set_remaining_time(remaining, day=day)
Ejemplo n.º 6
0
 def set_remaining_time(task, day, remaining_time):
     remaining = RemainingTime(self.env, task)
     remaining.set_remaining_time(remaining_time, day=day)
Ejemplo n.º 7
0
 def _create_remaining_time_series(self, ticket, start, time_series):
     rt = RemainingTime(self.env, ticket)
     for i, remaining_time in enumerate(time_series):
         day = start + (i * timedelta(days=1))
         rt.set_remaining_time(remaining_time, day=day)