mirror of
https://github.com/badlogic/heissepreise.git
synced 2024-06-16 05:34:21 +02:00
Don't backfill prices for charting.
This commit is contained in:
parent
1eb01af8a7
commit
0580fa709d
|
@ -40,7 +40,7 @@ function processFile(inputFile, outputFile, filter) {
|
|||
const fileDir = path.dirname(inputFile);
|
||||
const data = fs.readFileSync(inputFile, "utf8");
|
||||
if (filter(inputFile, false, data)) {
|
||||
console.log(`${inputFile} omitted by filter`);
|
||||
// console.log(`${inputFile} omitted by filter`);
|
||||
return;
|
||||
}
|
||||
console.log(`${inputFile} -> ${outputFile}`);
|
||||
|
@ -132,6 +132,7 @@ async function bundle(inputDir, outputDir, watch) {
|
|||
bundleHTML(inputDir, outputDir, false, watch, (filePath, isDir, data) => {
|
||||
if (isDir) return false;
|
||||
if (filePath.endsWith("style.css")) return true;
|
||||
if (filePath.endsWith(".js") && !filePath.includes("socket.io.js")) return true;
|
||||
if (data.includes(`require("`)) return true;
|
||||
return false;
|
||||
})
|
||||
|
|
|
@ -112,26 +112,19 @@ class ItemsChart extends View {
|
|||
const now = performance.now();
|
||||
const datasets = items.map((item) => {
|
||||
let price = null;
|
||||
const prices = uniqueDates.map((date) => {
|
||||
let prices = uniqueDates.map((date) => {
|
||||
const priceObj = item.priceHistory.find((item) => item.date === date);
|
||||
if (!price && priceObj) price = priceObj;
|
||||
return priceObj;
|
||||
});
|
||||
|
||||
const firstIndex = item.priceHistory.indexOf(price);
|
||||
|
||||
let lastPrice = null;
|
||||
for (let i = 0; i < prices.length; i++) {
|
||||
if (prices[i] == null) {
|
||||
if (i == 0) {
|
||||
if (firstIndex < item.priceHistory.length - 1) {
|
||||
price = item.priceHistory[firstIndex + 1];
|
||||
prices[i] = price;
|
||||
}
|
||||
} else {
|
||||
prices[i] = price;
|
||||
}
|
||||
const price = prices[i];
|
||||
if (price) {
|
||||
lastPrice = price;
|
||||
} else {
|
||||
price = prices[i];
|
||||
if (lastPrice) prices[i] = lastPrice;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,7 +135,6 @@ class ItemsChart extends View {
|
|||
dedupPrices.push({ price: price.price, date: uniqueDates[index] });
|
||||
} else {
|
||||
const lastPrice = dedupPrices[dedupPrices.length - 1];
|
||||
if (lastPrice.date == price.date && lastPrice.price == price.price) return;
|
||||
dedupPrices.push({ price: price.price, date: uniqueDates[index] });
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user