Beispiel #1
0
 def add_contingent_to_sprint(self, name, amount, sprint):
     # REFACT: why can't I say sprint.add_contingent('Foo', 12). That would seem so much nicer?
     # Maybe sprint.contingents.add('foo', 12) to have an easier time to separate stuff out.
     # That could also support stuff like {{{for contingent in sprint.contingents: ...}}}
     add_contingent_command = ContingentController.AddContingentCommand(
         self.env, sprint=sprint, name=name, amount=str(amount))
     ContingentController(self.env).process_command(add_contingent_command)
Beispiel #2
0
 def _execute(self, sp_controller, date_converter, as_key):
     from agilo.scrum.contingent import ContingentController
     ideal_capacity = self._calculate_capacity()
     get_contingent_total = ContingentController.GetSprintContingentTotalsCommand(
         sp_controller.env, sprint=self.sprint)
     contingent = ContingentController(
         sp_controller.env).process_command(get_contingent_total)
     net_capacity = ideal_capacity - contingent.amount
     return net_capacity
Beispiel #3
0
 def do_post(self, req):
     req.perm.assert_permission(Action.CONTINGENT_ADD_TIME)
     sprint = self._get_sprint(req)
     
     added_times = self._extract_added_times(req)
     cc = ContingentController(self.env)
     for name, amount in added_times.items():
         cmd = ContingentController.AddTimeToContingentCommand(self.env, sprint=sprint.name, name=name, delta=amount)
         cc.process_command(cmd)
     req.redirect(self.get_redirect_url(req, sprint))
Beispiel #4
0
    def do_post(self, req):
        req.perm.assert_permission(Action.CONTINGENT_ADD_TIME)
        sprint = self._get_sprint(req)

        added_times = self._extract_added_times(req)
        cc = ContingentController(self.env)
        for name, amount in added_times.items():
            cmd = ContingentController.AddTimeToContingentCommand(
                self.env, sprint=sprint.name, name=name, delta=amount)
            cc.process_command(cmd)
        req.redirect(self.get_redirect_url(req, sprint))
Beispiel #5
0
 def do_post(self, req):
     req.perm.assert_permission(Action.CONTINGENT_ADMIN)
     
     contingents_to_remove = req.args.getlist('sel')
     sprint = self._get_sprint(req)
     
     cc = ContingentController(self.env)
     for name in contingents_to_remove:
         cmd = ContingentController.DeleteContingentCommand(self.env, sprint=sprint.name, name=name)
         cc.process_command(cmd)
     req.redirect(self.get_redirect_url(req, sprint))
Beispiel #6
0
    def do_post(self, req):
        req.perm.assert_permission(Action.CONTINGENT_ADMIN)

        contingents_to_remove = req.args.getlist('sel')
        sprint = self._get_sprint(req)

        cc = ContingentController(self.env)
        for name in contingents_to_remove:
            cmd = ContingentController.DeleteContingentCommand(
                self.env, sprint=sprint.name, name=name)
            cc.process_command(cmd)
        req.redirect(self.get_redirect_url(req, sprint))
Beispiel #7
0
    def do_post(self, req):
        req.perm.assert_permission(Action.CONTINGENT_ADMIN)

        name = req.args.get('cont_name')
        amount = req.args.get('cont_amount')
        sprint = self._get_sprint(req)
        params = dict(sprint=sprint.name, name=name, amount=amount)
        try:
            cmd = ContingentController.AddContingentCommand(self.env, **params)
            ContingentController(self.env).process_command(cmd)
        except Exception, e:
            raise TracError(exception_to_unicode(e))
 def test_can_get_contingents_with_command(self):
     self._create_contingent('fnord', self.first_sprint, 42)
     contingent = ContingentController(self.env).get(name='fnord', sprint=self.first_sprint)
     self.assert_equals('fnord', contingent.name)
     self.assert_equals(self.first_sprint.name, contingent.sprint.name)
     self.assert_equals(42, contingent.amount)
     self.assert_equals(0, contingent.actual)
Beispiel #9
0
    def hourly_capacities_in_sprint(self, sprint):
        "Removes the sprints contingents from the capacity"
        # REFACT: I think it's a code smell to call up to the controller layer from the model layer like this
        from agilo.scrum.contingent import ContingentController
        summed_contingents = ContingentController(
            sprint.env).summed_contingents(sprint).amount

        capacities = self.hourly_capacities_in_interval(
            sprint.start, sprint.end)
        self._extend_hourly_capacity_until_end_of_sprint(capacities, sprint)
        if len(capacities) == 0 or summed_contingents <= 0:
            return capacities
        return self._deduct_contingent_from_daily_capacity(
            summed_contingents, capacities)
Beispiel #10
0
 def used_up_time_in_contingent(self, name, sprint):
     get_contingent_command = ContingentController.GetContingentCommand(
         self.env, sprint=sprint, name=name)
     return ContingentController(
         self.env).process_command(get_contingent_command).actual
 def _get_contingent_totals_for_sprint(self, sprint):
     cmd = ContingentController.GetSprintContingentTotalsCommand(self.env, sprint=sprint)
     return ContingentController(self.env).process_command(cmd)
 def _get_contingent(self, contingent_name, sprint):
     self._clear_model_cache()
     return ContingentController(self.env).get(name=contingent_name, sprint=sprint)
 def _create_contingent(self, contingent_name, sprint, amount):
     self._clear_model_cache()
     cmd = ContingentController.AddContingentCommand(self.env, name=contingent_name, sprint=sprint.name, amount=str(amount))
     ContingentController(self.env).process_command(cmd)
     return self._get_contingent(contingent_name, sprint)
 def _add_time_to_contingent(self, contingent_name, sprint, nr_hours):
     self._clear_model_cache()
     cmd = ContingentController.AddTimeToContingentCommand(self.env, name=contingent_name, sprint=sprint.name, delta=str(nr_hours))
     return ContingentController(self.env).process_command(cmd)
 def _create_contingent(self):
     self._clear_model_cache()
     cmd = ContingentController.AddContingentCommand(
         self.env, name=self.support, sprint=self.sprint.name, amount='20')
     ContingentController(self.env).process_command(cmd)
     return self._contingent()