fixing dashboard
All checks were successful
Deployment / deploy-docker (push) Successful in 15s

This commit is contained in:
Melchior Reimers
2026-01-25 16:54:34 +01:00
parent bbc5ec76d1
commit 9772d81f7d
2 changed files with 25 additions and 3 deletions

View File

@@ -306,6 +306,8 @@
<option value="exchange">By Exchange</option> <option value="exchange">By Exchange</option>
<option value="continent">By Continent</option> <option value="continent">By Continent</option>
<option value="sector">By Sector</option> <option value="sector">By Sector</option>
<option value="exchange_continent">Exchange + Region</option>
<option value="exchange_sector">Exchange + Sector</option>
</select> </select>
<div id="summary-step3" class="step-summary"></div> <div id="summary-step3" class="step-summary"></div>
</div> </div>
@@ -423,8 +425,24 @@
function updateSubGroupOptions() { function updateSubGroupOptions() {
const x = document.getElementById('axisX').value; const x = document.getElementById('axisX').value;
const sub = document.getElementById('axisSub'); const sub = document.getElementById('axisSub');
// Remove existing composite options first to avoid duplicates
// We need to reset the options or add them dynamically
// For simplicity, we'll just enable/disable standard ones and maybe append composite ones?
// Actually, let's just make sure they exist in the HTML (I will add them there)
// and toggling disabled state here.
Array.from(sub.options).forEach(opt => { Array.from(sub.options).forEach(opt => {
// Disable if same as X
opt.disabled = (opt.value === x); opt.disabled = (opt.value === x);
// Composite options are special: only allow them if X is time-based (day/month)
if (['exchange_continent', 'exchange_sector'].includes(opt.value)) {
opt.disabled = !['day', 'month'].includes(x);
opt.hidden = !['day', 'month'].includes(x);
}
if (opt.value === x && sub.value === x) sub.value = ''; if (opt.value === x && sub.value === x) sub.value = '';
}); });
} }

View File

@@ -84,9 +84,11 @@ async def get_analytics(
continents: str = None continents: str = None
): ):
# Determine if we need to join metadata # Determine if we need to join metadata
# Determine if we need to join metadata
composite_keys = ["exchange_continent", "exchange_sector"]
needs_metadata = any([ needs_metadata = any([
group_by in ["name", "continent", "sector"], group_by in ["name", "continent", "sector"] + composite_keys,
sub_group_by in ["name", "continent", "sector"], sub_group_by in ["name", "continent", "sector"] + composite_keys,
continents is not None continents is not None
]) ])
@@ -107,7 +109,9 @@ async def get_analytics(
"isin": f"{t_prefix}isin", "isin": f"{t_prefix}isin",
"name": f"coalesce({m_prefix}name, {t_prefix}isin)" if needs_metadata else "isin", "name": f"coalesce({m_prefix}name, {t_prefix}isin)" if needs_metadata else "isin",
"continent": f"coalesce({m_prefix}continent, 'Unknown')" if needs_metadata else "'Unknown'", "continent": f"coalesce({m_prefix}continent, 'Unknown')" if needs_metadata else "'Unknown'",
"sector": f"coalesce({m_prefix}sector, 'Unknown')" if needs_metadata else "'Unknown'" "sector": f"coalesce({m_prefix}sector, 'Unknown')" if needs_metadata else "'Unknown'",
"exchange_continent": f"concat({t_prefix}exchange, ' - ', coalesce({m_prefix}continent, 'Unknown'))" if needs_metadata else "'Unknown'",
"exchange_sector": f"concat({t_prefix}exchange, ' - ', coalesce({m_prefix}sector, 'Unknown'))" if needs_metadata else "'Unknown'"
} }
selected_metric = metrics_map.get(metric, metrics_map["volume"]) selected_metric = metrics_map.get(metric, metrics_map["volume"])