Example #1
0
 def _execute(self, sp_controller, date_converter, as_key):
     from agilo.scrum.backlog import BacklogModelManager
     bmm = BacklogModelManager(sp_controller.env)
     sprint_backlog = bmm.get(name=Key.SPRINT_BACKLOG, 
                              scope=self.sprint.name)
     if sprint_backlog is not None:
         backlog_items = sprint_backlog.values()
         backlog_items_ids = [bi.ticket.id for bi in backlog_items]
         for bi in backlog_items:
             if (bi[Key.STATUS] == Status.CLOSED) or \
                     self._has_at_least_a_closed_child(bi.ticket, backlog_items_ids):
                 # This container already had work on it started. Therefore we leave it in 
                 # this sprint to make clear that this is the sprint the story was started. 
                 # (to retain historical data)
                 
                 # In this case we just leave the ticket where it was
                 # No sense in deleting the BacklogItem, as it will be recreated anyway on the next load
                 # (Deleting the sprint from the ticket would delete the BacklogItem)
                 continue
             elif (bi[Key.SPRINT] == self.sprint.name):
                 log.info(sp_controller.env,
                          u'Retargeting ticket %d to sprint %s' % \
                          (bi.ticket.id, self.retarget.name))
                 # changing the ticket is enough to move the backlog item to the
                 # new backlog as the BacklogUpdater will do that
                 bi.ticket[Key.SPRINT] = self.retarget.name
                 bi.ticket.save_changes(author=self.author,
                                        comment='Moved from sprint %s' % self.sprint.name)
             else:
                 # This wasn't specifically planned and has not closed
                 # child left, therefore we can remove it
                 sprint_backlog.remove(bi)
Example #2
0
        def _execute(self, sp_controller, date_converter, as_key):
            from agilo.scrum.backlog import BacklogModelManager
            bmm = BacklogModelManager(sp_controller.env)
            sprint_backlog = bmm.get(name=Key.SPRINT_BACKLOG,
                                     scope=self.sprint.name)
            if sprint_backlog is not None:
                backlog_items = sprint_backlog.values()
                backlog_items_ids = [bi.ticket.id for bi in backlog_items]
                for bi in backlog_items:
                    if (bi[Key.STATUS] == Status.CLOSED) or \
                            self._has_at_least_a_closed_child(bi.ticket, backlog_items_ids):
                        # This container already had work on it started. Therefore we leave it in
                        # this sprint to make clear that this is the sprint the story was started.
                        # (to retain historical data)

                        # In this case we just leave the ticket where it was
                        # No sense in deleting the BacklogItem, as it will be recreated anyway on the next load
                        # (Deleting the sprint from the ticket would delete the BacklogItem)
                        continue
                    elif (bi[Key.SPRINT] == self.sprint.name):
                        log.info(sp_controller.env,
                                 u'Retargeting ticket %d to sprint %s' % \
                                 (bi.ticket.id, self.retarget.name))
                        # changing the ticket is enough to move the backlog item to the
                        # new backlog as the BacklogUpdater will do that
                        bi.ticket[Key.SPRINT] = self.retarget.name
                        bi.ticket.save_changes(author=self.author,
                                               comment='Moved from sprint %s' %
                                               self.sprint.name)
                    else:
                        # This wasn't specifically planned and has not closed
                        # child left, therefore we can remove it
                        sprint_backlog.remove(bi)
Example #3
0
 def environment_created(self):
     for table in db_default.schema:
         create_table(self.env, table)
     
     cache_manager = HttpRequestCacheManager(self.env)
     po_manager = PersistentObjectManager(self.env)
     for manager in cache_manager.managers:
         model_class = manager.for_model()
         if issubclass(model_class, PersistentObject):
             module_name = model_class.__module__
             # We don't want to create tables for dummy classes automatically
             # but the test finder may load some of these managers so we
             # need to exclude them here.
             if ('tests.' not in module_name):
                 po_manager.create_table(model_class)
     
     # Need to create Agilo types in the database before writing to the 
     # configuration - otherwise we get a warning during config setup (you'll
     # see it in every test case during setUp)
     db_default.create_default_types(self.env)
     initialize_config(self.env, __CONFIG_PROPERTIES__)
     db_default.create_default_backlogs(self.env)
     super(AgiloInit, self).environment_created()
     for listener in self.setup_listeners:
         listener.agilo_was_installed()
     # Reload the AgiloConfig to make sure all the changes have been updated
     AgiloConfig(self.env).reload()
     info(self, 'Agilo environment initialized')
Example #4
0
    def environment_created(self):
        for table in db_default.schema:
            create_table(self.env, table)

        cache_manager = HttpRequestCacheManager(self.env)
        po_manager = PersistentObjectManager(self.env)
        for manager in cache_manager.managers:
            model_class = manager.for_model()
            if issubclass(model_class, PersistentObject):
                module_name = model_class.__module__
                # We don't want to create tables for dummy classes automatically
                # but the test finder may load some of these managers so we
                # need to exclude them here.
                if ('tests.' not in module_name):
                    po_manager.create_table(model_class)

        # Need to create Agilo types in the database before writing to the
        # configuration - otherwise we get a warning during config setup (you'll
        # see it in every test case during setUp)
        db_default.create_default_types(self.env)
        initialize_config(self.env, __CONFIG_PROPERTIES__)
        db_default.create_default_backlogs(self.env)
        super(AgiloInit, self).environment_created()
        for listener in self.setup_listeners:
            listener.agilo_was_installed()
        # Reload the AgiloConfig to make sure all the changes have been updated
        AgiloConfig(self.env).reload()
        info(self, 'Agilo environment initialized')