Skip to content

Commit cc04adc

Browse files
committed
fix: remove random ratings; fix cluster rating calculation
1 parent bb91f6c commit cc04adc

4 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/lib/components/MapLibre.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@
9696
cluster={{
9797
radius: 75,
9898
properties: {
99-
total_rating: ['+', ['get', 'rating']]
99+
total_rating: ['+', ['case', ['has', 'rating'], ['get', 'rating'], 0]],
100+
total_rating_count: ['+', ['case', ['has', 'rating'], 1, 0]]
100101
}
101102
}}
102103
>
@@ -120,7 +121,7 @@
120121
'rgba(156, 47, 47, 0.9)' // red for >=300
121122
],
122123
MAX_ZOOM,
123-
createPointColor(['/', ['get', 'total_rating'], ['get', 'point_count']])
124+
createPointColor(['/', ['get', 'total_rating'], ['get', 'total_rating_count']])
124125
],
125126
'circle-radius': [
126127
'step',

src/lib/components/MapOverlays.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
)}</pre>
307307
</details>
308308
{@render overview(
309-
clickedFeature.total_rating / clickedFeature.point_count,
309+
clickedFeature.total_rating / clickedFeature.total_rating_count,
310310
undefined,
311311
undefined
312312
)}

src/lib/processors/DefaultProcessor.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ export class DefaultProcessor extends IEventProcessor {
4040
geohash: coordinates.geohash || undefined,
4141
coordinates: coordinates.lngLat,
4242
tags: event.tags,
43-
/** @todo Remove the random calculation when data is available. */
44-
rating: typeof rating !== 'undefined' ? rating : Math.floor(Math.random() * 5) + 1
43+
rating,
4544
}
4645
};
4746
}

src/lib/processors/Kind36820Processor.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ export class Kind36820Processor extends DefaultProcessor {
4848
geohash: coordinates.geohash || undefined,
4949
coordinates: coordinates.lngLat,
5050
tags: event.tags,
51-
/** @todo Remove the random calculation when data is available. */
52-
rating: typeof rating !== 'undefined' ? rating : Math.floor(Math.random() * 5) + 1
51+
rating,
5352
}
5453
};
5554
}

0 commit comments

Comments
 (0)