Exclude free trade fairs from table results

This commit is contained in:
2026-02-21 13:08:54 +01:00
parent bf25e0f70e
commit 97b101b05e
2 changed files with 29 additions and 3 deletions

View File

@@ -1539,7 +1539,7 @@
<div id="bookmarkQuickStatus" class="bookmark-status" aria-live="polite" hidden></div>
</form>
<details class="bookmark-subpage" id="tradeFairsSubpage">
<summary class="bookmark-subpage__summary">📍 Top 30 Messen in Deutschland (nach Besucherzahlen)</summary>
<summary class="bookmark-subpage__summary">📍 Top Messen in Deutschland (nach Besucherzahlen, ohne kostenlose Messen)</summary>
<div class="bookmark-subpage__content">
<div class="bookmark-subpage__toolbar">
<label class="bookmark-panel__search">

View File

@@ -561,6 +561,29 @@
}
];
function isFreeTradeFair(row) {
const prices = [
toNumber(row.ticketpreis_we_eur),
toNumber(row.ticketpreis_unterderwoche_eur)
].filter((value) => value !== null);
if (!prices.length) {
return false;
}
return prices.every((price) => price === 0);
}
const EFFECTIVE_TRADE_FAIRS = TRADE_FAIRS
.filter((row) => !isFreeTradeFair(row))
.sort((a, b) => (a.rang || 0) - (b.rang || 0))
.map((row, index) => ({
...row,
rang: index + 1
}));
const HIDDEN_FREE_FAIRS_COUNT = TRADE_FAIRS.length - EFFECTIVE_TRADE_FAIRS.length;
const SORT_TYPES = {
tage_bis_start: 'number',
rang: 'number',
@@ -1111,7 +1134,7 @@
}
function render() {
const normalizedRows = TRADE_FAIRS.map(normalizeRow);
const normalizedRows = EFFECTIVE_TRADE_FAIRS.map(normalizeRow);
const filtered = normalizedRows.filter((row) => matchesSearch(row, searchTerm));
const sorted = sortRows(filtered);
const columnOrder = getColumnOrderFromHeader();
@@ -1140,7 +1163,10 @@
const activeSortButton = sortButtons.find((button) => button.dataset.tradeSort === sortKey);
const sortLabel = activeSortButton?.dataset.baseLabel || sortKey;
meta.textContent = `${sorted.length} von ${TRADE_FAIRS.length} Messen | Sortierung: ${sortLabel} (${sortDirection === 'asc' ? 'aufsteigend' : 'absteigend'})`;
const hiddenInfo = HIDDEN_FREE_FAIRS_COUNT > 0
? ` | ${HIDDEN_FREE_FAIRS_COUNT} kostenlose Messe${HIDDEN_FREE_FAIRS_COUNT === 1 ? '' : 'n'} ausgeblendet`
: '';
meta.textContent = `${sorted.length} von ${EFFECTIVE_TRADE_FAIRS.length} Messen${hiddenInfo} | Sortierung: ${sortLabel} (${sortDirection === 'asc' ? 'aufsteigend' : 'absteigend'})`;
}
sortButtons.forEach((button) => {