~mwhudson/lava-dashboard/multiple-runs-of-same-build-number

« back to all changes in this revision

Viewing changes to dashboard_app/views/images.py

  • Committer: Michael Hudson-Doyle
  • Date: 2013-02-08 02:34:11 UTC
  • Revision ID: michael.hudson@linaro.org-20130208023411-hkpo7gpvz0eggh0o
surprisingly cheap hack

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
from dashboard_app.filters import evaluate_filter
31
31
from dashboard_app.models import (
32
32
    LaunchpadBug,
33
 
    Image,    ImageSet,
 
33
    Image,
 
34
    ImageSet,
34
35
    TestRun,
35
36
)
36
37
from dashboard_app.views import index
82
83
        for test_run in match.test_runs:
83
84
            name = test_run.test.test_id
84
85
            denorm = test_run.denormalization
85
 
            if denorm.count_fail:
86
 
                cls = 'present fail'
 
86
            if denorm.count_pass == denorm.count_all():
 
87
                cls = 'present pass'
87
88
            else:
88
 
                cls = 'present pass'
 
89
                    cls = 'present fail'
89
90
            bug_ids = sorted([b.bug_id for b in test_run.launchpad_bugs.all()])
90
91
            test_run_data = dict(
 
92
                present=True,
91
93
                cls=cls,
92
94
                uuid=test_run.analyzer_assigned_uuid,
93
95
                passes=denorm.count_pass,
94
 
                total=denorm.count_pass + denorm.count_fail,
 
96
                total=denorm.count_all(),
95
97
                link=test_run.get_permalink(),
96
98
                bug_ids=bug_ids,
97
99
                )
98
 
            if match.tag not in build_number_to_cols:
99
 
                # This assumes 1 bundle per match...
100
 
                build_number_to_cols[match.tag] = {
 
100
            if (match.tag, test_run.bundle.uploaded_on) not in build_number_to_cols:
 
101
                build_number_to_cols[(match.tag, test_run.bundle.uploaded_on)] = {
101
102
                    'test_runs': {},
102
103
                    'number': match.tag,
103
 
                    'bundles': [],
 
104
                    'date': test_run.bundle.uploaded_on,
 
105
                    'link': test_run.bundle.get_absolute_url(),
104
106
                    }
105
 
            bundle_data = {
106
 
                'date': test_run.bundle.uploaded_on,
107
 
                'link': test_run.bundle.get_absolute_url(),
108
 
            }
109
 
            if bundle_data not in build_number_to_cols[match.tag]['bundles']:
110
 
                build_number_to_cols[match.tag]['bundles'].append(
111
 
                    {
112
 
                        'date': test_run.bundle.uploaded_on,
113
 
                        'link': test_run.bundle.get_absolute_url(),
114
 
                    })
115
 
            build_number_to_cols[match.tag]['test_runs'].setdefault(
116
 
                name, []).append(test_run_data)
 
107
            build_number_to_cols[(match.tag, test_run.bundle.uploaded_on)]['test_runs'][name] = test_run_data
117
108
            if name != 'lava':
118
109
                test_run_names.add(name)
119
110
 
128
119
    for test_run_name in test_run_names:
129
120
        row_data = []
130
121
        for col in cols:
131
 
            row_data.append(col['test_runs'].get(test_run_name, []))
 
122
            test_run_data = col['test_runs'].get(test_run_name)
 
123
            if not test_run_data:
 
124
                test_run_data = dict(
 
125
                    present=False,
 
126
                    cls='missing',
 
127
                    )
 
128
            row_data.append(test_run_data)
132
129
        table_data.append(row_data)
133
130
 
134
131
    return render_to_response(