Skip to content
Permalink
Browse files

economy summaries fix

  • Loading branch information...
Manuel-777 committed Apr 14, 2019
1 parent 3017722 commit f6c6c4998024dec17b161b23113519d9580a08c4
Showing with 8 additions and 7 deletions.
  1. +8 −7 window_main/economy.js
@@ -528,9 +528,8 @@ function createChangeRow(change, economyId) {
}

function createEconomyUI(mainDiv) {
daysago = 0;
daysago = -999;
dayList = [];
dayList[0] = new economyDay();
economyHistory.changes.sort(compare_economy);

var topSelectItems = ["All", "Day Summaries"];
@@ -539,9 +538,14 @@ function createEconomyUI(mainDiv) {
for (var n = 0; n < economyHistory.changes.length; n++) {
let economyId = economyHistory.changes[n];
let change = economyHistory[economyId];

if (change == undefined) continue;

if (daysago != differenceInCalendarDays(new Date(), change.date)) {
daysago = differenceInCalendarDays(new Date(), change.date);
dayList[daysago] = new economyDay();
console.log("new day", change.date);
}

let ctx = change.originalContext || change.context;
change.contextPretty = getPrettyContext(ctx);
change.context = getPrettyContext(ctx, false);
@@ -558,11 +562,8 @@ function createEconomyUI(mainDiv) {
if (change.delta.goldDelta > 0)
dayList[daysago].goldEarned += change.delta.goldDelta;
else dayList[daysago].goldSpent += Math.abs(change.delta.goldDelta);
}

if (daysago != differenceInCalendarDays(new Date(), change.date)) {
daysago = differenceInCalendarDays(new Date(), change.date);
dayList[daysago] = new economyDay();
console.log(economyId, "> ", change.date, " > ", change.delta.goldDelta);
}
}

0 comments on commit f6c6c49

Please sign in to comment.
You can’t perform that action at this time.