Fix pump operational icon

This commit is contained in:
Pieter Fiers 2020-07-16 16:08:51 +02:00
parent 67ceb04148
commit 27411692b4

View file

@ -1,5 +1,5 @@
import {LayerDefinition} from "../LayerDefinition"; import {LayerDefinition} from "../LayerDefinition";
import {And, Tag, TagsFilter} from "../../Logic/TagsFilter"; import {And, Tag, TagsFilter, Or} from "../../Logic/TagsFilter";
import * as L from "leaflet"; import * as L from "leaflet";
import BikeStationChain from "../Questions/bike/StationChain"; import BikeStationChain from "../Questions/bike/StationChain";
import BikeStationPumpTools from "../Questions/bike/StationPumpTools"; import BikeStationPumpTools from "../Questions/bike/StationPumpTools";
@ -15,9 +15,10 @@ import PumpValves from "../Questions/bike/PumpValves";
export default class BikeStations extends LayerDefinition { export default class BikeStations extends LayerDefinition {
private readonly pump: TagsFilter = new Tag("service:bicycle:pump", "yes"); private readonly pump = new Tag("service:bicycle:pump", "yes");
private readonly pumpOperational: TagsFilter = new Tag("service:bicycle:pump:operational_status", "yes"); private readonly pumpOperationalAny = new Tag("service:bicycle:pump:operational_status", "yes");
private readonly tools: TagsFilter = new Tag("service:bicycle:tools", "yes"); private readonly pumpOperationalOk = new Or([new Tag("service:bicycle:pump:operational_status", "yes"), new Tag("service:bicycle:pump:operational_status", "operational"), new Tag("service:bicycle:pump:operational_status", "ok")]);
private readonly tools = new Tag("service:bicycle:tools", "yes");
constructor() { constructor() {
super(); super();
@ -59,7 +60,7 @@ export default class BikeStations extends LayerDefinition {
const self = this; const self = this;
return function (properties: any) { return function (properties: any) {
const hasPump = self.pump.matchesProperties(properties) const hasPump = self.pump.matchesProperties(properties)
const isOperational = self.pumpOperational.matchesProperties(properties) const isOperational = !self.pumpOperationalAny.matchesProperties(properties) || self.pumpOperationalOk.matchesProperties(properties)
const hasTools = self.tools.matchesProperties(properties) const hasTools = self.tools.matchesProperties(properties)
let iconName = "" let iconName = ""
if (hasPump) { if (hasPump) {