Example #1
0
def move_to_sprint(sender, instance, **kwargs):
    if not instance.has_scrum_data:
        return
    wb_data = parse_whiteboard(instance.whiteboard)
    if 's' in wb_data:
        newsprint = wb_data['s']
        if instance.sprint and newsprint == instance.sprint.slug:
            # already in the sprint
            return

        newsprint_obj = None
        proj = None
        new_projs = instance.projects_from_product()
        for proj in new_projs:
            try:
                newsprint_obj = Sprint.objects.get(team=proj.team,
                                                   slug=newsprint)
                break
            except Sprint.DoesNotExist:
                continue

        if not newsprint_obj:
            return

        if instance.sprint:
            BugSprintLog.objects.removed_from_sprint(instance,
                                                     instance.sprint)
        instance.sprint = newsprint_obj
        instance.project = proj
        BugSprintLog.objects.added_to_sprint(instance, newsprint_obj)
Example #2
0
def move_to_sprint(sender, instance, **kwargs):
    if not instance.has_scrum_data:
        return
    wb_data = parse_whiteboard(instance.whiteboard)
    if 's' in wb_data:
        newsprint = wb_data['s']
        if instance.sprint and newsprint == instance.sprint.slug:
            # already in the sprint
            return
        if instance.project is None:
            new_proj = instance.project_from_product
            if new_proj is None:
                return
            # add to ready backlog
            log.debug('Adding %s to %s', instance, new_proj)
            instance.project = new_proj

        try:
            newsprint_obj = Sprint.objects.get(team=instance.project.team,
                                               slug=newsprint)
        except Sprint.DoesNotExist:
            return

        if instance.sprint:
            BugSprintLog.objects.removed_from_sprint(instance,
                                                     instance.sprint)
        instance.sprint = newsprint_obj
        BugSprintLog.objects.added_to_sprint(instance, newsprint_obj)
Example #3
0
def move_to_sprint(sender, instance, **kwargs):
    if not instance.has_scrum_data:
        return
    wb_data = parse_whiteboard(instance.whiteboard)
    newsprint = None
    if 's' in wb_data:
        newsprint = wb_data['s']
    elif instance.target_milestone and instance.target_milestone != '---' \
            and TM_RE.match(instance.target_milestone):
        newsprint = instance.target_milestone

    if newsprint:
        if instance.sprint and newsprint == instance.sprint.slug:
            # already in the sprint
            return

        newsprint_obj = None
        proj = None
        new_projs = instance.projects_from_product()
        for proj in new_projs:
            try:
                newsprint_obj = Sprint.objects.get(team=proj.team,
                                                   slug=newsprint)
                break
            except Sprint.DoesNotExist:
                continue

        if not newsprint_obj:
            return

        if instance.sprint:
            BugSprintLog.objects.removed_from_sprint(instance, instance.sprint)
        instance.sprint = newsprint_obj
        instance.project = proj
        BugSprintLog.objects.added_to_sprint(instance, newsprint_obj)
Example #4
0
 def test_parse_whiteboard_commas(self):
     """parse_whiteboard() should return the correct data with commas."""
     wbd = parse_whiteboard('things,u=dude c=bowling,p=10,[qawanted]')
     self.assertDictEqual(wbd, {
         'u': 'dude',
         'c': 'bowling',
         'p': '10',
     })
Example #5
0
 def test_parse_whiteboard_brackets(self):
     """parse_whiteboard() should return the correct data with brackets."""
     wbd = parse_whiteboard('things,[u=dude c=bowling p=10] other stuff')
     self.assertDictEqual(wbd, {
         'u': 'dude',
         'c': 'bowling',
         'p': '10',
     })
Example #6
0
 def test_parse_whiteboard(self):
     """parse_whiteboard() should return the correct data."""
     wbd = parse_whiteboard('u=dude c=bowling p=10')
     self.assertDictEqual(wbd, {
         'u': 'dude',
         'c': 'bowling',
         'p': '10',
     })
Example #7
0
 def test_parse_whiteboard_commas(self):
     """parse_whiteboard() should return the correct data with commas."""
     wbd = parse_whiteboard('things,u=dude c=bowling,p=10,[qawanted]')
     self.assertDictEqual(wbd, {
         'u': 'dude',
         'c': 'bowling',
         'p': '10',
     })
Example #8
0
 def test_parse_whiteboard_brackets(self):
     """parse_whiteboard() should return the correct data with brackets."""
     wbd = parse_whiteboard('things,[u=dude c=bowling p=10] other stuff')
     self.assertDictEqual(wbd, {
         'u': 'dude',
         'c': 'bowling',
         'p': '10',
     })
Example #9
0
 def test_parse_whiteboard(self):
     """parse_whiteboard() should return the correct data."""
     wbd = parse_whiteboard('u=dude c=bowling p=10')
     self.assertDictEqual(wbd, {
         'u': 'dude',
         'c': 'bowling',
         'p': '10',
     })