mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-01 22:09:26 -06:00
Better, non-hacky solution
This commit is contained in:
+3
-7
@@ -107,13 +107,9 @@ export function makeIconSets(
|
||||
const toPick = icons.map(icon => {
|
||||
return {
|
||||
icon: icon,
|
||||
// Number of times we'd expect to see this, divided by number of times we saw it. Special cased for
|
||||
// icons that have to show every time. Which kinda tells me the algorithm is broken, but this was
|
||||
// enough to get things working for now.
|
||||
error:
|
||||
icon.topIconShowEvery === 1
|
||||
? Infinity
|
||||
: result.length / icon.topIconShowEvery / (sponsorAppearanceCount.get(icon) || 0.00001),
|
||||
// Number of times we'd expect to see this, divided by number of times we saw it, assuming that we pick
|
||||
// this one next.
|
||||
error: (result.length + 1) / icon.topIconShowEvery / ((sponsorAppearanceCount.get(icon) || 0) + 1),
|
||||
};
|
||||
});
|
||||
toPick.sort((lhs, rhs) => rhs.error - lhs.error);
|
||||
|
||||
Reference in New Issue
Block a user