Skip to content

Commit

Permalink
Merge pull request #43 from SJVAir/fix/aqview-calibrator
Browse files Browse the repository at this point in the history
Fix: Aqview Calibrators
  • Loading branch information
alexandermccormick authored Feb 23, 2024
2 parents 2d9795f + ae7ca21 commit d211e7a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"files": [
"dist"
],
"version": "1.8.9",
"version": "1.8.10",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -17,7 +17,7 @@
"@types/d3": "^7.4.3",
"@types/leaflet": "^1.9.8",
"@types/leaflet.markercluster": "^1.5.4",
"@types/node": "20.11.19",
"@types/node": "20.11.20",
"@vitejs/plugin-vue": "^5.0.4",
"@vuepic/vue-datepicker": "^8.1.1",
"axios": "^1.6.7",
Expand All @@ -29,7 +29,7 @@
"leaflet-svg-shape-markers": "^1.4.0",
"leaflet.markercluster": "^1.5.3",
"sass": "^1.71.1",
"terser": "^5.27.2",
"terser": "^5.28.1",
"typescript": "^5.3.3",
"uplot": "^1.6.30",
"vite": "^5.1.4",
Expand Down
2 changes: 1 addition & 1 deletion src/Calibrators/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function getCalibratorByRefId(id: string): Calibrator | undefined {
return calibrators.value.find(c => c.reference_id === id);
}

export function isCalibrator(monitor: Monitor | string): boolean {
export function isCalibratorObject(monitor: Monitor | string): boolean {
return (typeof monitor === "string")
? calibrators.value.some(c => c.id === monitor)
: calibrators.value.some(c => c.id === monitor.data.id);
Expand Down
11 changes: 7 additions & 4 deletions src/DisplayOptions/MonitorMarkers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ref, watch } from "vue";
import { useRouter } from "vue-router";
import { useInteractiveMap } from "../Map";
import { isCalibrator, getCalibratorById, getCalibratorByRefId, monitorIsCalibrator, useCalibratorsService } from "../Calibrators";
import { isCalibratorObject, getCalibratorById, getCalibratorByRefId, monitorIsCalibrator, useCalibratorsService } from "../Calibrators";
import L from "../modules/Leaflet";
import { asyncInitializer, darken, dateUtil, readableColor, toHex } from "../modules";
import { MonitorDisplayField, MonitorDataField, useMonitorsService, getMonitor } from "../Monitors";
Expand Down Expand Up @@ -117,10 +117,11 @@ export const useMonitorMarkers = asyncInitializer<MonitorMarkersModule>(async (r
displayRefs,
() => {
monitorMarkersMap.forEach((marker, id) => {
const monitor = isCalibrator(id)
const monitor = isCalibratorObject(id)
? getCalibratorById(id)!
: monitors.value[id];


if (isVisible(monitor)) {
monitorMarkersGroup.addLayer(marker);

Expand Down Expand Up @@ -232,9 +233,11 @@ function isVisible(monitor: Monitor | Calibrator): boolean {
: monitorMarkersVisibility.AirNow.model.value;

case "AQview":
return monitorMarkersVisibility.AQview.model.value;
return (monitorIsCalibrator(monitor))
? monitorMarkersVisibility.Calibrators.model.value || monitorMarkersVisibility.AQview.model.value
: monitorMarkersVisibility.AQview.model.value;
}
} else if ("id" in monitor && isCalibrator(monitor.id)) {
} else if ("id" in monitor && isCalibratorObject(monitor.id)) {
const ref = getMonitor(monitor.reference_id);

if(!monitorMarkersVisibility.displayInactive.model.value && !ref.data.is_active){
Expand Down

0 comments on commit d211e7a

Please sign in to comment.