471
471
lane = report_tools.lane(store, opts.lane)
472
472
lanes = report_tools.lanes(store)
474
bp_status_totals = {'Completed': 0, 'Total': 0, 'Percentage': 0}
474
475
for status, cards in report_tools.statuses(store, lane):
475
476
cards_with_bps = []
476
477
for card in cards:
478
479
blueprint_status_counts = report_tools.card_bp_status_counts(
479
480
store, card.roadmap_id)
480
481
total = sum(blueprint_status_counts.values())
482
bp_percentages = dict.fromkeys(ROADMAP_ORDERED_STATUSES, 0)
483
bp_status_totals['Completed'] += \
484
blueprint_status_counts['Completed']
482
485
for key in ROADMAP_STATUSES_MAP:
483
bp_percentages[key] = 0
486
bp_status_totals['Total'] += blueprint_status_counts[key]
485
488
bp_percentages[key] = (
486
489
100.0 * blueprint_status_counts[key] / total)
489
492
'bp_statuses': blueprint_status_counts,
490
493
'bp_percentages': bp_percentages})
491
494
statuses.append(dict(name=status, cards=cards_with_bps))
495
if bp_status_totals['Total'] > 0:
496
bp_status_totals['Percentage'] = (100 * bp_status_totals['Completed'] /
497
bp_status_totals['Total'])
493
499
data.update(dict(statuses=statuses))
500
data.update(dict(bp_status_totals=bp_status_totals))
494
501
data.update(dict(status_order=ROADMAP_ORDERED_STATUSES))
495
502
data.update(dict(page_type="roadmap_lane"))
496
503
data.update(dict(lane_title=title))
515
522
title = opts.title
517
524
blueprints = report_tools.card_blueprints_by_status(store, card.roadmap_id)
518
blueprint_status_count = WorkitemTarget()
519
blueprint_status_count.todo = len(blueprints['Planned'])
520
blueprint_status_count.blocked = len(blueprints['Blocked'])
521
blueprint_status_count.inprogress = len(blueprints['In Progress'])
522
blueprint_status_count.postponed = 0
523
blueprint_status_count.done = len(blueprints['Completed'])
524
card_has_blueprints = (blueprint_status_count.todo +
525
blueprint_status_count.blocked +
526
blueprint_status_count.inprogress +
527
blueprint_status_count.postponed +
528
blueprint_status_count.done) > 0
525
bp_status_totals = {'Completed': 0, 'Total': 0, 'Percentage': 0}
526
bp_status_totals['Total'] = (len(blueprints['Planned']) +
527
len(blueprints['Blocked']) +
528
len(blueprints['In Progress']) +
529
len(blueprints['Completed']))
530
bp_status_totals['Completed'] = len(blueprints['Completed'])
531
if bp_status_totals['Total'] > 0:
532
bp_status_totals['Percentage'] = (100 * bp_status_totals['Completed'] /
533
bp_status_totals['Total'])
535
card_has_blueprints = bp_status_totals['Total'] > 0
530
537
status_order = ROADMAP_ORDERED_STATUSES[:]
531
538
status_order.reverse()
537
544
data.update(dict(lane=lane.name))
538
545
data.update(dict(status_order=status_order))
539
546
data.update(dict(blueprints=blueprints))
540
data.update(dict(blueprint_status_count=blueprint_status_count))
547
data.update(dict(bp_status_totals=bp_status_totals))
541
548
data.update(dict(card_has_blueprints=card_has_blueprints))
543
550
print report_tools.fill_template(