def tags(): from wafwfy.models import Story from collections import defaultdict stories = Story.all() tags = defaultdict(list) for story in stories: for label in story.get('labels', []): tags[label].append(story) return jsonify(objects=tags)
def tags_count(): from wafwfy.models import Story from collections import defaultdict stories = Story.all() # build a mapping tag -> id of the epic epics = app.config.get('EPICS') tag_to_id = {} for cnt, epic_label in enumerate(epics): for tag in epics[epic_label]: tag_to_id[tag] = cnt tags = defaultdict(lambda:defaultdict(lambda: 0)) for story in stories: for label in story.get('labels', []): if label not in tag_to_id: continue tags[tag_to_id[label]][story['current_state']] += \ story.get('estimate', 0.5) return jsonify(objects=tags)
def story(): from wafwfy.models import Story stories = Story.all() return jsonify(objects=list(stories))