akhilrex / hammond

Self hosted vehicle and expense management system. Like Clarkson, but better
GNU Affero General Public License v3.0
550 stars 50 forks source link

Stats sum is wrong, if "This Year" is selected #87

Closed heikok88 closed 2 years ago

heikok88 commented 2 years ago

Please complete the following information

Describe the bug I have only one Vehicle in Hammond with only 5 fillups in 2022. The stats are wrong if I select "This Year". "Past 3 Months" and "All Time" are correct. See the screenshots

Expected behavior If "This Year" is selected, the first fillup (Jan 25, 2022, 78,93 €) is missing in the sum and should be included.

Screenshots Stats_ThisYear_wrong Stats_Past3Month_correct Stats_AllTime_correct Fillups

akhilrex commented 2 years ago

Will look into it

heikok88 commented 2 years ago

Thx! If you need my db, logs or something like that let me know.

heikok88 commented 2 years ago

Might it possible, that the first fillup to a vehicle is not included in the sum?

If you need help let me know, I'm a (embedded) software engineer ;-)

heikok88 commented 2 years ago

I've looked into the code and found the error: In your statsWidget.vue, you have to pass 0 as month for january. The days start by 1, but the month start by 0.

heikok88 commented 2 years ago

I've found another error. If in the stats "This week" is selected, you need to call toDate.setHours(0, 0, 0, 0) to set the time to midnight. Because otherwise the the fillup of mondays before the time of the requests are not included.

heikok88 commented 2 years ago

Should I create a pullrequest?

akhilrex commented 2 years ago

Please do

On Tue, 12 Jul 2022 at 00:24, heikok88 @.***> wrote:

Should I create a pullrequest?

— Reply to this email directly, view it on GitHub https://github.com/akhilrex/hammond/issues/87#issuecomment-1180752313, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMVPSIULZ5UE76LGGZQCDVTRUVRANCNFSM5UGFB5WQ . You are receiving this because you commented.Message ID: @.***>

-- Thanks and Regards, Akhil Gupta

heikok88 commented 2 years ago

Just created the PR Greets