bagisto / bagisto

Free and open source laravel eCommerce platform
https://bagisto.com
Open Software License 3.0
15.27k stars 2.2k forks source link

Admin Dash has way too many queries #7103

Closed JakeOcean closed 1 year ago

JakeOcean commented 1 year ago

Terms

Bagisto Version(s) affected

1.4.5

Issue Description

The main Admin Dashboard, within DashboardController@Index creates way too many queries to sum the total sales for each day.

It creates 3x queries per day selected, so if you view 90 days you are getting way too many queries -- these can be grouped together in mysql and then looped over to build the array

What is the best way for me to optimize this query without losing my changes with future Bagisto Updates?

Do I need to override the whole controller? I see a page in the docs about creating new packages, but I dont see much advices about optimizing the DB queries themselves

Preconditions

fresh install

Steps to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected Result

less queries

Actual Result

too many

Screenshots

No response

Additional context

No response

Sanjaybhattwebkul commented 1 year ago

@jitendra-webkul Now, this issue is fixed. so I am closing this issue.