restyle page, add area filters

This commit is contained in:
2026-04-04 15:27:12 +02:00
parent fbe50790da
commit e1745841b1
2 changed files with 13 additions and 1 deletions

View File

@@ -309,7 +309,7 @@ def _check_filters(listing: RawListing, travel: dict[str, int]) -> bool:
)
passed = False
# --- Area filter ---
if listing.woonoppervlak is not None and listing.woonoppervlak is not > config.MIN_AREA:
if listing.woonoppervlak is not None and listing.woonoppervlak < config.MIN_AREA:
log.info(f"Gefilterd op oppervlakte: {listing.woonoppervlak} < {config.MIN_AREA}")
passed = False

View File

@@ -389,6 +389,11 @@
<label>Max prijs</label>
<input type="number" id="f-prijs" value="300000" min="0" step="5000">
</div>
<div class="filter-group">
<label>Min opp.</label>
<input type="number" id="f-opp" value="65" min="0" max="300">
<label></label>
</div>
<div class="filter-group">
<label>Sorteer</label>
<select id="f-sort">
@@ -398,6 +403,8 @@
<option value="prijs_desc">Prijs ↓</option>
<option value="ov_mark_asc">OV Mark ↑</option>
<option value="fiets_mark_asc">Fiets Mark ↑</option>
<option value="opp_asc">Opp. ↑</option>
<option value="opp_desc">Opp. ↓</option>
</select>
</div>
<button id="filter-reset">Reset</button>
@@ -414,6 +421,7 @@ const DEFAULTS = {
'f-ov-michelle': 45,
'f-fiets-mark': 40,
'f-prijs': 300000,
'f-opp': 65,
'f-sort': 'first_seen_desc',
};
@@ -555,6 +563,7 @@ function get_filters() {
ov_michelle: parseInt(document.getElementById('f-ov-michelle').value) || Infinity,
fiets_mark: parseInt(document.getElementById('f-fiets-mark').value) || Infinity,
prijs: parseInt(document.getElementById('f-prijs').value) || Infinity,
opp: parseInt(document.getElementById('f-opp').value) || 0,
sort: document.getElementById('f-sort').value,
};
}
@@ -566,6 +575,8 @@ const SORT_FNS = {
prijs_desc: (a, b) => (b.prijs || 0) - (a.prijs || 0),
ov_mark_asc: (a, b) => (a.ov_mark ?? 999) - (b.ov_mark ?? 999),
fiets_mark_asc: (a, b) => (a.fiets_mark ?? 999) - (b.fiets_mark ?? 999),
opp_asc: (a, b) => (a.woonoppervlak ?? 0) - (b.woonoppervlak ?? 0),
opp_desc: (a, b) => (b.woonoppervlak ?? 0) - (a.woonoppervlak ?? 0),
};
function apply() {
@@ -575,6 +586,7 @@ function apply() {
if (f.ov_michelle < Infinity && (l.ov_michelle == null || l.ov_michelle > f.ov_michelle)) return false;
if (f.fiets_mark < Infinity && (l.fiets_mark == null || l.fiets_mark > f.fiets_mark)) return false;
if (l.prijs != null && l.prijs > f.prijs) return false;
if (f.opp > 0 && (l.woonoppervlak == null || l.woonoppervlak < f.opp)) return false;
return true;
});