Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/intelligence.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* @property {string} reason - Why this zone is predicted to be high demand.
*/

const MAX_ORDERS_FOR_FULL_INTENSITY = 10;

export const Intelligence = {
/**
* Predicts future waste volume based on historical data.
Expand Down Expand Up @@ -66,7 +68,7 @@ export const Intelligence = {
getHighDemandZones: (providers, allOrders) => {
return providers.map(p => {
const providerOrders = allOrders.filter(o => o.providerId === p.id);
const intensity = Math.min(providerOrders.length / 10, 1);
const intensity = Math.min(providerOrders.length / MAX_ORDERS_FOR_FULL_INTENSITY, 1);
return {
lat: p.lat + (Math.random() - 0.5) * 0.01, // Slight offset for visual "area"
lng: p.lng + (Math.random() - 0.5) * 0.01,
Expand Down