@@ -41,7 +41,7 @@ def template(name):
41
41
RESULT_IMAGES = template ('result_images' )
42
42
43
43
44
- def status_sort (status ):
44
+ def get_status_sort (status ):
45
45
s = 50
46
46
if status ['overall' ] == 'failed' :
47
47
s -= 10
@@ -119,6 +119,7 @@ def card(name, item, warn_missing=None):
119
119
module = '.' .join (name .split ('.' )[:- 1 ])
120
120
121
121
status , classes , badge = get_status (item , card_id , warn_missing )
122
+ status_sort = get_status_sort (status )
122
123
123
124
if item ['diff_image' ] is None :
124
125
image = f'<img src="{ item ["result_image" ]} " class="card-img-top" alt="result image">'
@@ -170,15 +171,15 @@ def card(name, item, warn_missing=None):
170
171
id = card_id ,
171
172
test_name = test_name ,
172
173
module = module ,
173
- status_sort = status_sort ( status ) ,
174
+ status_sort = status_sort ,
174
175
175
176
image = image ,
176
177
badge = badge ,
177
178
offcanvas = offcanvas ,
178
179
179
180
)
180
181
181
- return result_card
182
+ return result_card , status_sort
182
183
183
184
184
185
def generate_summary_html (results , results_dir ):
@@ -196,15 +197,16 @@ def generate_summary_html(results, results_dir):
196
197
classes += ['no-hash-test' ]
197
198
198
199
# Generate result cards
199
- cards = ''
200
+ cards = []
200
201
for name , item in results .items ():
201
- cards += card (name , item , warn_missing = warn_missing )
202
+ cards += [card (name , item , warn_missing = warn_missing )]
203
+ cards = [j [0 ] for j in sorted (cards , key = lambda i : i [1 ])]
202
204
203
205
# Generate HTML
204
206
html = BASE .format (
205
207
title = "Image comparison" ,
206
208
navbar = NAVBAR ,
207
- cards = cards ,
209
+ cards = " \n " . join ( cards ) ,
208
210
filter = FILTER ,
209
211
classes = " " .join (classes ),
210
212
)
0 commit comments