Exclude free trade fairs from table results
This commit is contained in:
@@ -1539,7 +1539,7 @@
|
|||||||
<div id="bookmarkQuickStatus" class="bookmark-status" aria-live="polite" hidden></div>
|
<div id="bookmarkQuickStatus" class="bookmark-status" aria-live="polite" hidden></div>
|
||||||
</form>
|
</form>
|
||||||
<details class="bookmark-subpage" id="tradeFairsSubpage">
|
<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__content">
|
||||||
<div class="bookmark-subpage__toolbar">
|
<div class="bookmark-subpage__toolbar">
|
||||||
<label class="bookmark-panel__search">
|
<label class="bookmark-panel__search">
|
||||||
|
|||||||
@@ -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 = {
|
const SORT_TYPES = {
|
||||||
tage_bis_start: 'number',
|
tage_bis_start: 'number',
|
||||||
rang: 'number',
|
rang: 'number',
|
||||||
@@ -1111,7 +1134,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
const normalizedRows = TRADE_FAIRS.map(normalizeRow);
|
const normalizedRows = EFFECTIVE_TRADE_FAIRS.map(normalizeRow);
|
||||||
const filtered = normalizedRows.filter((row) => matchesSearch(row, searchTerm));
|
const filtered = normalizedRows.filter((row) => matchesSearch(row, searchTerm));
|
||||||
const sorted = sortRows(filtered);
|
const sorted = sortRows(filtered);
|
||||||
const columnOrder = getColumnOrderFromHeader();
|
const columnOrder = getColumnOrderFromHeader();
|
||||||
@@ -1140,7 +1163,10 @@
|
|||||||
|
|
||||||
const activeSortButton = sortButtons.find((button) => button.dataset.tradeSort === sortKey);
|
const activeSortButton = sortButtons.find((button) => button.dataset.tradeSort === sortKey);
|
||||||
const sortLabel = activeSortButton?.dataset.baseLabel || 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) => {
|
sortButtons.forEach((button) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user