feat(viewer): sort holdings cards by position weight descending
Display largest position first in the holdings panel for better readability
This commit is contained in:
@@ -403,7 +403,13 @@ function renderHoldings(day, meta) {
|
||||
}
|
||||
|
||||
let html = '';
|
||||
for (const code of day.holdings) {
|
||||
// Sort holdings by weight descending (largest position first)
|
||||
const sortedHoldings = [...day.holdings].sort((a, b) => {
|
||||
const wa = day.assets[a] && day.assets[a].weight !== null ? day.assets[a].weight : 0;
|
||||
const wb = day.assets[b] && day.assets[b].weight !== null ? day.assets[b].weight : 0;
|
||||
return wb - wa;
|
||||
});
|
||||
for (const code of sortedHoldings) {
|
||||
const a = day.assets[code];
|
||||
if (!a) continue;
|
||||
const info = meta.codes[code] || {};
|
||||
|
||||
Reference in New Issue
Block a user