nickslick03 / messiah-meal-planner

1 stars 0 forks source link

Result charts #40

Closed nickslick03 closed 3 weeks ago

nickslick03 commented 3 weeks ago

Created two charts: a stacked bar chart displaying the amount spent per week stacked by location, and a pie chart with the amount paid per week by location. It might make more sense to show the totals spent instead of weekly but that might be a separate PR to write extra helper functions since the calculator is only set up to return one meal total.

cdrice26 commented 3 weeks ago

Okay, I've looked over it and it's definitely nice to have these great charts in the results section! The pie chart was a good idea, I was going to suggest that but you beat me to it:). I did make several changes:

I think you're spot on about total cost, it would be more ideal but would probably require another PR. Let me know what you think! I recognize this is a lot of changes, most are minor but feel free to let me know if something doesn't work right, if something is a large enough change to merit its own PR, or if you have any questions/concerns about these changes or something that should be changed back. I was sort of just trying to move the sprint forward but also recognize there is such a thing as moving too fast:).

nickslick03 commented 3 weeks ago

Wow, everything looks great! I've made it so that the charts now account for the student plan meal price. Unfortunately, when testing out the app I did notice some weird behavior from entering the start date and end date (put console.log({ startDate, endDate }); into App.tsx and you'll see what I'm talking about), which only happens in this PR and not in the development branch. Before doing a deep dive I'm working if there's any code you've written in this PR that could be causing this?

cdrice26 commented 3 weeks ago

Huh, that's really weird, I can't think of anything, and I'm fairly certain I didn't add anything that sets the date (I did a quick search for startDate across the whole project and couldn't seem to find anything problematic)...but you're right, for some reason the start date seems to be setting to two days after the day you selected. I can keep looking over this as well, and hopefully between the two of us we'll find something?

cdrice26 commented 3 weeks ago

I think I fixed it! The problem was my getAllDatesBetween function, it was calling setDate() on the startDate which was passed in as a parameter, and Date is a reference type. I fixed it by having it create a new Date when it calls itself instead of mutating startDate.