|
|
@@ -523,6 +523,7 @@ class Transaction{
|
|
|
module.exports = Transaction;
|
|
|
},{}],6:[function(require,module,exports){
|
|
|
let analytics = {
|
|
|
+ newData: false,
|
|
|
dateChange: false,
|
|
|
transactions: [],
|
|
|
ingredient: {},
|
|
|
@@ -531,12 +532,12 @@ let analytics = {
|
|
|
display: function(Transaction){
|
|
|
document.getElementById("analDateBtn").onclick = ()=>{this.changeDates(Transaction)};
|
|
|
|
|
|
- if(this.transactions.length === 0){
|
|
|
+ if(this.transactions.length === 0 || this.newData === true){
|
|
|
let startDate = new Date();
|
|
|
startDate.setMonth(startDate.getMonth() - 1);
|
|
|
const dateIndices = controller.transactionIndices(merchant.transactions, startDate);
|
|
|
|
|
|
- this.transactions = merchant.transactions.slice(dateIndices[0], dateIndices[1]);
|
|
|
+ this.transactions = merchant.transactions.slice(dateIndices[0], dateIndices[1] + 1);
|
|
|
}
|
|
|
|
|
|
let slider = document.getElementById("analSlider");
|
|
|
@@ -665,6 +666,11 @@ let analytics = {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(i === this.transactions.length - 1){
|
|
|
+ quantities.push(this.ingredient.ingredient.convert(currentQuantity));
|
|
|
+ dates.push(currentDate);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
let trace = {
|
|
|
@@ -741,6 +747,11 @@ let analytics = {
|
|
|
quantity += recipe.quantity;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(i === this.transactions.length - 1){
|
|
|
+ quantities.push(quantity);
|
|
|
+ dates.push(currentDate);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const trace = {
|
|
|
@@ -1073,6 +1084,7 @@ controller = {
|
|
|
case "transaction":
|
|
|
transactions.isPopulated = false;
|
|
|
transactions.display(Transaction);
|
|
|
+ analytics.newData = true;
|
|
|
break;
|
|
|
}
|
|
|
},
|