support/scripts/pkg-stats: fix bug when sorting by hashfile

Because the div_class variable was not reassigned a value,
cells in the latest_version column were still being assigned
hash_file classes and so were being picked up as elements in
the hash_file sort. This lead to execessive grid gap elements
stacking up and creating huge blank spaces at the top of the page.
This is very noticable on pages with a large number of packages,
like the ones the autobuilder creates.

original behaviour(click the "Hash file" column label twice):
http://autobuild.buildroot.org/stats/master.html

demo of fixed behaviour:
https://sen-h.codeberg.page/pkg-stats-demos/@pages/fix-bug-when-sorting-by-hash-file.html

Signed-off-by: Sen Hastings <sen@hastings.org>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
(cherry picked from commit 6e3d79f52e)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Sen Hastings 2024-02-25 14:05:44 -08:00 committed by Peter Korsgaard
parent 81deca8719
commit 59c153dbcd

View File

@ -977,6 +977,7 @@ def dump_html_pkg(f, pkg):
# Latest version
data_field_id = f'latest_version__{pkg_css_class}'
div_class = ["centered"]
div_class.append(f'_{pkg_css_class}')
div_class.append("latest_version data")
if pkg.latest_version['status'] == RM_API_STATUS_ERROR: