Skip to content

Commit

Permalink
Merge pull request #29 from thaddeus/filter-historical-prices
Browse files Browse the repository at this point in the history
Filter historical prices
  • Loading branch information
Razzmatazzz authored Oct 11, 2024
2 parents 52bef28 + a01b395 commit 131a224
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 8 additions & 10 deletions datasources/historical-prices.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@ class historicalPricesAPI extends WorkerKVSplit {
let prices = cache.historicalPricePoint[itemId];
if (!prices) {
return [];
}
else if (days === this.maxDays) {
}
/*if (days === this.maxDays) {
return prices;
}*/
const cutoffTimestamp = new Date().setDate(new Date().getDate() - days);
let dayFiltered = prices.filter(hp => hp.timestamp >= cutoffTimestamp);
if (halfResults) {
dayFiltered = dayFiltered.filter((hp, index) => index % 2 === 0);
}
else {
const cutoffTimestamp = new Date().setDate(new Date().getDate() - days);
let dayFiltered = prices.filter(hp => hp.timestamp >= cutoffTimestamp);
if (halfResults) {
dayFiltered = dayFiltered.filter((hp, index) => index % 2 === 0);
}
return dayFiltered;
}
return dayFiltered;
}
}

Expand Down
2 changes: 1 addition & 1 deletion schema-static.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ type MapArtilleryZone {
outline: [MapPosition]
top: Float
bottom: Float
radius: Float
radius: Float @deprecated(reason: "Use outline instead.")
}
type MapExtract {
Expand Down

0 comments on commit 131a224

Please sign in to comment.