Esempio n. 1
0
def apply_point_estimates(estimator):
    stories = filter_backlog(estimator.fetch_stories())
    bins = [1, 3, 5, 8, 13, 25, 50, 100]
    bin_size = int(math.ceil(len(stories) / float(len(bins))))
    
    def estimate(story, i):
        bin = int(i / bin_size)
        if story.is_estimatable():
            story.estimate = bins[bin]
            story.safe_sync()
            
    progress.iter_index(stories, estimate)
Esempio n. 2
0
def apply_effort_order(estimator):
    stories = filter_backlog(estimator.fetch_stories())

    def order(story, i):
        desc = getattr(story, 'description', '')
        if effort_key in desc:
            story.description = re.sub(effort_key + '\d+', effort_key + str(i), desc)
        elif origin_key in desc:
            pos = desc.find(origin_key)
            story.description = desc[:pos] + ('\n' * (key_sep_lines - 1)) + effort_key + str(i) +'\n' + desc[pos:]
        else:
            story.description = desc + ('\n' * key_sep_lines) + effort_key + str(i)
        story.safe_sync()

    progress.iter_index(stories, order)
Esempio n. 3
0
def order_backlog(existing_backlog, order):
    existing_order = filter(lambda so: contains_story_id(existing_backlog, so[0]), order)
    if len(existing_order) == 0: return
    first = existing_order[0]
    first_unstarted = with_elem(existing_order, 'unstarted')
    first_unscheduled = with_elem(existing_order, 'unscheduled')
    # Gets the id of the next story in the section, given start index and jump distance
    def get_next(start_index, iter_jump):
        new_index = start_index + iter_jump
        if new_index < 0 or new_index >= len(existing_order):
            return None
        else:
            return existing_order[new_index][0]
    
    def is_tail_story(story_id):
        if story_id == None: return False
        def equalsID(story_order): 
            return False if (story_order == None) else (story_id == story_order[0])
        return not (equalsID(first) or equalsID(first_unstarted) or equalsID(first_unscheduled))

    def apply_order(story_order, i):
        story = get_story_by_id(existing_backlog, story_order[0])
        next_id = get_next(i, 1)
        prev_id = get_next(i, -1)

        if is_tail_story(story.id):
            story.after_id = prev_id
            prev_story = get_story_by_id(existing_backlog, prev_id)
            # releases could be out of order; e.g., unstarted, but still mixed with started
            # hence they have to be moved first, then the before_id on the original synced
            if prev_story.story_type == 'release':
                prev_story.before_id = story.id
                prev_story.safe_sync()
        
        if is_tail_story(next_id):
            story.before_id = next_id
            next_story = get_story_by_id(existing_backlog, next_id)
            # releases could be out of order; e.g., unstarted, but still mixed with started
            # hence they have to be moved first, then the before_id on the original synced
            if next_story.story_type == 'release':
                next_story.after_id = story.id
                next_story.safe_sync()

        story.safe_sync()
    
    progress.iter_index(existing_order, apply_order)