KylerJohnson / budget

0 stars 0 forks source link

Fix historical chart data #15

Open KylerJohnson opened 6 years ago

KylerJohnson commented 6 years ago

The historical chart data does not build correctly. The data is added to the oldest date first and incremented. There is no month checking. That is, if there is expense data for the year, and there is less income data for a given field, that field will show income starting at the earliest expense.

The fix is to check for data based on the year and month combination.

KylerJohnson commented 6 years ago

It looks as though since the expense data and income data are built separately, and since the size of the array is determined by the min/max dates for all the resources, you can have one (either expense or income data array) smaller than the other. When the chart data is built in chart_functions.js, the data set appends the array of points, assuming they are all the same size.

At some point, the data needs to be merged more carefully accounting for different data set sizes. I think currently, the best option is to do so in the analytics controller, or possibly build an analytics method that generates the merged income and expense data with correct offsets.