~linaro-automation/launchpad-work-items-tracker/linaro

« back to all changes in this revision

Viewing changes to html-report

  • Committer: Mattias Backman
  • Date: 2012-01-17 13:42:18 UTC
  • mfrom: (326.2.1 linaro-staging)
  • Revision ID: mattias.backman@linaro.org-20120117134218-0urptefy6cjsad6a
Add progress bar to roadmap lane views and change cards to use the same bar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
471
471
        lane = report_tools.lane(store, opts.lane)
472
472
        lanes = report_tools.lanes(store)
473
473
        statuses = []
 
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())
481
 
                bp_percentages = {}
 
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]
484
487
                    if total > 0:
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'])
492
498
 
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
516
523
 
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'])
 
534
 
 
535
        card_has_blueprints = bp_status_totals['Total'] > 0
529
536
 
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))
542
549
 
543
550
        print report_tools.fill_template(