[feat] sort infobox so images are first (#6815)
Some checks failed
Documentation / Release (push) Has been cancelled
Integration / Python 3.11 (push) Has been cancelled
Integration / Python 3.12 (push) Has been cancelled
Integration / Python 3.13 (push) Has been cancelled
Integration / Python 3.14 (push) Has been cancelled
Integration / Theme (push) Has been cancelled
Sync / Codeberg (push) Has been cancelled

Often there will be two or more results in the infobox.

We now sort this so infoboxes with an image show above those that do not.

Signed-off-by: vojkovic <git@vojk.au>
This commit is contained in:
Brock Vojkovic 2026-10-04 14:16:51 +08:00 • committed by GitHub
parent 44b98e6102
commit d48c4b5554
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -182,6 +182,8 @@ class ResultContainer:
def close(self):
self._closed = True
# infobox with images first
self.infoboxes.sort(key=lambda infobox: not infobox.img_src)
for result in self.main_results_map.values():
result.score = calculate_score(result, result.priority)