This commit is contained in:
@@ -306,6 +306,8 @@
|
||||
<option value="exchange">By Exchange</option>
|
||||
<option value="continent">By Continent</option>
|
||||
<option value="sector">By Sector</option>
|
||||
<option value="exchange_continent">Exchange + Region</option>
|
||||
<option value="exchange_sector">Exchange + Sector</option>
|
||||
</select>
|
||||
<div id="summary-step3" class="step-summary"></div>
|
||||
</div>
|
||||
@@ -423,8 +425,24 @@
|
||||
function updateSubGroupOptions() {
|
||||
const x = document.getElementById('axisX').value;
|
||||
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 => {
|
||||
// Disable if same as 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 = '';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -84,9 +84,11 @@ async def get_analytics(
|
||||
continents: str = None
|
||||
):
|
||||
# Determine if we need to join metadata
|
||||
# Determine if we need to join metadata
|
||||
composite_keys = ["exchange_continent", "exchange_sector"]
|
||||
needs_metadata = any([
|
||||
group_by in ["name", "continent", "sector"],
|
||||
sub_group_by in ["name", "continent", "sector"],
|
||||
group_by in ["name", "continent", "sector"] + composite_keys,
|
||||
sub_group_by in ["name", "continent", "sector"] + composite_keys,
|
||||
continents is not None
|
||||
])
|
||||
|
||||
@@ -107,7 +109,9 @@ async def get_analytics(
|
||||
"isin": f"{t_prefix}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'",
|
||||
"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"])
|
||||
|
||||
Reference in New Issue
Block a user