def fetch_stories(refresh_clients=False): """ fetch userstories from pivotaltracker and add some information into the database. """ redis.flushdb() request = PivotalRequest() pipe = redis.pipeline(transaction=True) for iteration in request.iter_iterations(): iteration_id = iteration['id'] Iteration.create(iteration, pipe=pipe) app.logger.info('Processing iteration: %s', iteration_id) for story in request.iter_stories(iteration['stories']): story_id = story['id'] Story.create(story, pipe=pipe) Iteration.add_story(iteration_id, story_id, pipe=pipe) app.logger.info(story_id) app.logger.info('retrieve stories in the icebox') for story in request.iter_icebox(): story_id = story['id'] Story.create(story, pipe=pipe) app.logger.info(story_id) pipe.execute() if refresh_clients: from wafwfy.events import refresh_clients as refresh_clients_fun refresh_clients_fun()
def velocity_for_n_iteractions(num): from wafwfy.models import Iteration all_velocity = [] current_iteration = Iteration.get_current() for i in range(num): all_velocity.append(Iteration.get_velocity_for_iteration(current_iteration-i-1)) all_velocity.reverse() return jsonify(object=all_velocity)
def index(): from datetime import datetime from wafwfy.models import Iteration from wafwfy.helpers import calculate_team_percentages today = datetime.now() velocity = Iteration.get_current_velocity() completed, total = Iteration.get_current_points() strength = float(Iteration.get_current_strength()) team_percentages = calculate_team_percentages(strength) return render_template('index.html', epics=app.config.get('EPICS').keys(), day=today.day, month=today.strftime("%B"), velocity=velocity, team_strength=team_percentages, completed_points=completed, total_points=int(velocity * strength), )
def current_velocity(): from wafwfy.models import Iteration return jsonify(object=Iteration.get_current_velocity())
def velocity_for_iteraction(id): from wafwfy.models import Iteration return jsonify(object=Iteration.get_velocity_for_iteration(id))