-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/speed up endpoint performance #6631
Refactor/speed up endpoint performance #6631
Conversation
…en array of ENUMs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pauloiankoski nice optimization, I just pointed out places that you don't need to use the ModelQueryBuilder
and instead should just use QueryBuilder
or DB::table()
. The ModelQueryBuilder
's main purpose is to return a model instance when you call get()
or getAll()
. Since your doing manual queries and calling count()
in the end, there would be no reason to use the ModelQueryBuilder
.
4979744
to
e13dd57
Compare
cf63857
to
2150d7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job man!
@jonwaldstein @pauloiankoski I'll be honest, this PR actually makes me a little nervous. The point of making the Model-oriented list tables was to further decouple (albeit not 100%) the list tables from the database structure. The bit in here for clearing the selects on |
@JasonTheAdams from what I understand, the main thing is not using the models for getting total counts specifically. I'm fine with that optimization as we don't need to join a bunch of tables just to get the total records number. Maybe some of these simple queries can just be moved into the repository itself so they're not called directly in the list tables. |
@jonwaldstein @pauloiankoski Did you explore using SQL_CALC_FOUND_ROWS and FOUND_ROWS() so we don't have to reconstruct the query for the count? It seems like the count is just being used to calculate the total rows for the query? |
@JasonTheAdams According to the most recent docs, I believe we are in line with the most recent recommendations:
@jonwaldstein At first, I had this idea of adding a parameter to the |
@pauloiankoski thanks, we wouldn't want to do that though because those However I was thinking we could just have some simple methods on the repositories that do counts like: |
@jonwaldstein As I have to check some conditions related to the filters we have on the tables, I'd need to have an instance of Detach the meta from I'd be able to use that function for the counting. It's an empty query builder where I can easily run the count method. PS: As a good developer, naming functions is not one of my strengths. I would love to also hear your thoughts @JasonTheAdams. |
@pauloiankoski Out of curiosity, for the count query, if all we do is remove all other selects upon |
@JasonTheAdams After a long battle against the system over the last couple of days, I was finally able to run the tests. I ran the queries 3 times for each amount and tabulated the median value (Y axis in log scale): This is not science but I do believe the results are meaningful. What I can read from the results are:
|
* feature: add ListTable class * feature: add Column class * feature: add concerns * feature: add exception classes * feature: add DonationsListTable class * feature: use DonationsListTable class; add new REST parameters for sorting * feature: register DonationsListTable on container * refactor: method name * refactor: return type * refactor: add getters; change prop visibility * refactor: localize table definitions * refactor: update properties names to match react list table component * feature: add tests * chore: update formatting * refactor: update test name * refactor: get array values * feature: test column properties * fix: test - use the proper method * feature: add sort and filter tests * refactor: make column sortable by default * refactor: change method name * refactor: change method name * refactor: sort * refactor: update tests * fix: use correct prop name; add return types * feature: begin switching to column classes * feature: add donor and gateway columns * refactor: switch to a model-oriented methodology * test: add startsSubscription to donation test * refactor: move columns to simpler namespace * feature: update status column to model column * refactor: rename namespaces * refactor: change columns implementation * chore: add columns as classes * refactor: add helpers for payment statuses and type * refactor: fix prop and function names * refactor: move items concerno to ListTable * refactor: change query to use Donations model * refactor: move controller methods to the endpoint class * refactor: change to call constructor directly instead of through container * chore: add missing phpdocs * refactor: reformat code * fix: change sort keys * chore: remove mentions to startsSubscription prop * fix: remove default value for locale * refactor: rename function * refactor: change date formatting function * chore: add unreleased tag and complete docblocks info * fix: change prop type * refactor: change tableAlias to use columnAlias instead of index * chore: implement count method for ModelQueryBuilder * refactor: change where clauses to use tableAlias * refactor: replace Query Builder with Donations model * refactor: move locale parameter to items method * chore: add action to DonationsListTable singleton * refactor: replace instantiates with singleton * fix: add fallback to $columnAlias * refactor: reformat frontend files with prettier * Epic Feature: Column sorting UI (#6600) * feature: add table sorting component and styles * fix: removed .items from data.items.map to reflect sortedData value * feature: install interweave * feature: add support for sorting * fix: include static data in window objects for testing * refactor: update file name for consistency * fix: enable tables to recieve column data from window * feature: add new window values to interface * fix: add isSortable to static data to test * fix: update to reflect. window.Give_.table.columns * refactor: update handle sort * refactor: simplify conditional * update cursor styles when sortable * add svgs to image folder * fix: display interweave based on column name * fix: move click handler outside of svg * fix: attach event handlers to button instead of svg * refactor: add aria support & include data posting * feature: add interweave & styles * fix: update table sort * fix: include columns, sortColoumn and sortDirection in query params * feature: add svgs to assets * fix: update props and function name * fix: update styles * fix: update styles * fix: remove static columns * fix: use element for id values * fix: update state name & pass proper data to interweave * fix: re-add test data for donors * fix: update property name to match column * fix: update to reflect passed in data * fix: clean up list table directories * fix: rename function * fix: use idbadge * fix: update interweave * fix: pass correct prop value * fix: update bulk actions with interweave * fix: remove form columns * fix: remove inline styles * fix: add refunded badge * fix: remove comment * fix: update donor styles * fix: update sort button styles * fix: update imports and file names * refactor: optimize imports for new directories * refactor: remove unused component * refactor: remove unsupported column properties * fix: row actions always display first column * feature: add repeat donor icon * fix: update interweave styles: * fix: remove [en] fallback for locales * feature: check for visible columns * chore: add DonorsListTable class and register it * refactor: merge controller into the endpoint class * chore: add new parameters to endpoint * refactor: change main query to use Donors model * chore: add Id Column to Donors List Table * chore: add Donor Information column to Donors List Table * fix: add label for deprecated status * chore: add Donation Count column to Donors List Table chore: add aria label * chore: add Latest Donation column to Donors List Table * refactor: add DonorType enum and replace where it's used * chore: add Donor Type column to Donors List Table * chore: add Date Created column to Donors List Table * refactor: remove additional emails from meta keys * refactor: add DonorModelQueryBuilder class * chore: attach additional emails to query results * fix: replace removed constant * feature: add value method to Query Builder * chore: add Donation Revenue column to Donors List Table * refactor: change method to use ModelQueryBuilder * refactor: bring additional_email meta key back to the ENUM class * chore: add unreleased tags * refactor: remove unused classes * chore: fix typo * refactor: change hooks to use Give ones * chore: add description to function * refactor: replace if statements with ternary operator * feature: add donor properties and * chore: revert * feature: add support for ->totalAmountDonated and ->totalNumberOfDonation in donor repository * feature: add new properties to factory * fix: flter out any null objects being returnd from query * tests: scaffold list donors first test * refactor: change additionalEmails query so that doesn't return null row * refactor: change columns to use the new properties * tests: add tests for donors list table * Epic Feature: Donor and Form table styles (#6610) * fix: update svg size and styles * fix: include additional status styles * feature: add no donation svg & styles * feature: add goal achieved star svg * fix: include form styles * feature: init Donation Form model scaffold * refactor: rename donation forms repository binding * feature: add initial DonationForms properties * feature: add methods to query data from database * doc: add docblocks to new methods * feature: connect query results to model * refactor: implement DonationFormLevel class * feature: implement values from database for $totalAmountDonated and $totalNumberOfDonations * refactor: implement DonationFormStatus class * feature: add method to create DonationFormLevel from a price string * feature: read price option and fill the model with the correct meta data * refactor: remove factory method while not yet implemented * tests: add tests for form model and dto with a new nifty legacy form adapter * refactor: move implementations from controller to endpoint class * feature: add DonationFormsListTable * refactor: change endpoint to make use of the new ListTable class * refactor: remove unused methods * feature: add TitleColumn to DonationFormsListTable * feature: add LevelsColumn to DonationFormsListTable * feature: change endpoints to support return an array of models * refactor: add return type to admin endpoint call args * feature: add DonationCountColumn to DonationFormsListTable coutcolumn * feature: add DonationRevenueColumn to DonationFormsListTable * feature: add ShortcodeColumn to DonationFormsListTable * feature: add DateCreatedColumn to DonationFormsListTable * feature: add StatusColumn to DonationFormsListTable * feature: add GoalColumn to DonationFormsListTable * feature: add support for sorting columns to DonationFormsListTable * fix: cast column to be sorted as number * tests: update DonationFormTest with new faux donation form model factory methods * Feature: Donation table Live/Test switch (#6613) * feature: add test toggle * feature: add toggle state * feature: include mode in table api * feature: update endpoint with mode * refactor: rename mode param to testMode * refactor: update naming conventions * fix: update styles * feature: include paymentgateway mode in donation window * feature: set initial testMode state to payment mode * refactor: pass toggle from donations table * fix: update test styles * fix: correct react hooks order warning * fix: update toggle * fix: update props * fix: remove unused imports * fix: add additional form styles * refactor: use only one conditional * refactor: move row actions to separate file for consistency * fix: simplify testmode styles * refactor: update testmode * refactor: change default value for testMode parameter Co-authored-by: Paulo Iankoski <[email protected]> * Feature/form UI subscriptions table endpoint (#6616) * feature: add test toggle * feature: add toggle state * feature: include mode in table api * feature: update endpoint with mode * refactor: rename mode param to testMode * refactor: update naming conventions * fix: update styles * feature: include paymentgateway mode in donation window * feature: set initial testMode state to payment mode * refactor: pass toggle from donations table * fix: update test styles * fix: correct react hooks order warning * fix: update toggle * fix: update props * fix: remove unused imports * fix: add additional form styles * refactor: use only one conditional * refactor: move row actions to separate file for consistency * fix: simplify testmode styles * refactor: update testmode * feature: add subscription table styles * feature: add subscriptions table * feature: add toggle * fix: remove unused import * test: add test for ListDonations endpoint * fix: replace controller with new endpoint class * refactor: rename endpoint class * test: add tests for ListDonationForms * refactor: remove unused preload methods * feature: register admin scripts * feature: init SubscriptionListTable with IdColumn on it * feature: register endpoints for Subscriptions * feature: append SubscriptionsListTable to GiveSubscriptions global * fix: pass a default currency value when nullable * test: add test for ListSubscriptions endpoint * feature: add labels to Value Object * feature: add new Columns to SubscriptionsListTable * feature: implement extra data for tooltip on StatusColumn * fix: update with subscription * refactor: remove invalid tests * fix:update testmodebadge * fix: update webpack * fix: update form filters * fix: add non breaking whitespace to status messages * Revert "fix: add non breaking whitespace to status messages" This reverts commit 61b2729. * fix: wrap tooltip content with a p tag * fix: pass payment mode to table * fix: update styles * fix: solve undefined index notice * fix: update font weight styles * refactor: change how migrations are registered for subscriptions * fix: update column size by table * feature: add subscription actions * fix: update expired bkg color * fix: update test filter * fix: replace margin with gap * fix: update failed status to failing * fix: update toggle size * feature: add payment_mode column to Subscriptions * fix: move handleItemSort * refactor: replace query loop with a single update query * fix: display by testModeFilter * fix: initialize as paymentMode * feature: save subscription payment mode when legacy payment gateway is used * refactor: rewrite endpoint hander to use the model * fix: add bulk delete * fix: fix donations bulk delete * feature: make form column sortable * feature: implement delete action on the subscriptions endpoint * doc: add missing unreleased tags * fix: update svg size * doc: add missing docblock * refactor: create model methods for conditionals Co-authored-by: Joshua Dinh <[email protected]> * Fix: Bulk checkboxes reset checked value after sorting (#6618) * fix: update preapproval label * fix: uncheck bulkaction checkbox when component unmounts * Fix: Limited subscription tooltip messages use correct nouns. (#6625) * fix:update failed message with bold text * fix: use _n function for singular vs plural * format: reformat code Co-authored-by: Paulo Iankoski <[email protected]> * Refactor/speed up endpoint performance (#6631) * refactor: replace endpoint request with direct query * refactor: remove other selects when counting * feature: add method to return an array of meta aliases based on a given array of ENUMs * refactor: replace prepareQuery on count methods of list endpoints with custom query * refactor: replace ModelQueryBuilder with QueryBuilder * refactor: remove unused namespaces * Fix/subscription payment mode column (#6633) * Refactor/speed up endpoint performance (#6635) * refactor: remove quote from having column name * refactor: keep existing columns on count as they may needed for group by * refactor: attach meta to donations count query only as needed * refactor: conditionally use having when there is another where clause * refactor: replace strings with ENUMs * doc: append array content type * Refactor/list table columns for addons (#6639) * refactor: rename getColumns function avoiding overwriting * refactor: add self return to methods * refactor: add parameter to method * Fix: Subscriptions renewed past their end date notify users of a potential error. (#6628) * feature: add over ran status for limited subscriptions * fix: update to failing svg * fix: add max width * fix: update placement of message for overrun * fix: update unreleased tag * fix: update terminology to exceed * Fix: New Donation table button added for users with the Manual Donations Add-on (#6638) * feature: add new donation button while manual donations add-on is active * fix: add unreleased tag * refactor: remove hasManualDonations * refactor: update with template literals * fix: remove boolean conversion * Fix: Loading animations are immediately visible regardless of page height (#6649) * feature: apply fixed styling to animation if page is scrollable * Fix: remove state changes * chore: remove duplicated css Co-authored-by: Paulo Iankoski <[email protected]> * fix: rename sortColumn value for donationsCount column * refactor: update test namespaces * tests: update tests after changes to DB statements * refactor: prevent migration of trying to add column twice Co-authored-by: alaca <[email protected]> Co-authored-by: Jason Adams <[email protected]> Co-authored-by: Joshua Dinh <[email protected]> Co-authored-by: Joshua Dinh <[email protected]> Co-authored-by: Jon Waldstein <[email protected]>
* feature: add ListTable class * feature: add Column class * feature: add concerns * feature: add exception classes * feature: add DonationsListTable class * feature: use DonationsListTable class; add new REST parameters for sorting * feature: register DonationsListTable on container * refactor: method name * refactor: return type * refactor: add getters; change prop visibility * refactor: localize table definitions * refactor: update properties names to match react list table component * feature: add tests * chore: update formatting * refactor: update test name * refactor: get array values * feature: test column properties * fix: test - use the proper method * feature: add sort and filter tests * refactor: make column sortable by default * refactor: change method name * refactor: change method name * refactor: sort * refactor: update tests * fix: use correct prop name; add return types * feature: begin switching to column classes * feature: add donor and gateway columns * refactor: switch to a model-oriented methodology * test: add startsSubscription to donation test * refactor: move columns to simpler namespace * feature: update status column to model column * refactor: rename namespaces * refactor: change columns implementation * chore: add columns as classes * refactor: add helpers for payment statuses and type * refactor: fix prop and function names * refactor: move items concerno to ListTable * refactor: change query to use Donations model * refactor: move controller methods to the endpoint class * refactor: change to call constructor directly instead of through container * chore: add missing phpdocs * refactor: reformat code * fix: change sort keys * chore: remove mentions to startsSubscription prop * fix: remove default value for locale * refactor: rename function * refactor: change date formatting function * chore: add unreleased tag and complete docblocks info * fix: change prop type * refactor: change tableAlias to use columnAlias instead of index * chore: implement count method for ModelQueryBuilder * refactor: change where clauses to use tableAlias * refactor: replace Query Builder with Donations model * refactor: move locale parameter to items method * chore: add action to DonationsListTable singleton * refactor: replace instantiates with singleton * fix: add fallback to $columnAlias * refactor: reformat frontend files with prettier * Epic Feature: Column sorting UI (#6600) * feature: add table sorting component and styles * fix: removed .items from data.items.map to reflect sortedData value * feature: install interweave * feature: add support for sorting * fix: include static data in window objects for testing * refactor: update file name for consistency * fix: enable tables to recieve column data from window * feature: add new window values to interface * fix: add isSortable to static data to test * fix: update to reflect. window.Give_.table.columns * refactor: update handle sort * refactor: simplify conditional * update cursor styles when sortable * add svgs to image folder * fix: display interweave based on column name * fix: move click handler outside of svg * fix: attach event handlers to button instead of svg * refactor: add aria support & include data posting * feature: add interweave & styles * fix: update table sort * fix: include columns, sortColoumn and sortDirection in query params * feature: add svgs to assets * fix: update props and function name * fix: update styles * fix: update styles * fix: remove static columns * fix: use element for id values * fix: update state name & pass proper data to interweave * fix: re-add test data for donors * fix: update property name to match column * fix: update to reflect passed in data * fix: clean up list table directories * fix: rename function * fix: use idbadge * fix: update interweave * fix: pass correct prop value * fix: update bulk actions with interweave * fix: remove form columns * fix: remove inline styles * fix: add refunded badge * fix: remove comment * fix: update donor styles * fix: update sort button styles * fix: update imports and file names * refactor: optimize imports for new directories * refactor: remove unused component * refactor: remove unsupported column properties * fix: row actions always display first column * feature: add repeat donor icon * fix: update interweave styles: * fix: remove [en] fallback for locales * feature: check for visible columns * chore: add DonorsListTable class and register it * refactor: merge controller into the endpoint class * chore: add new parameters to endpoint * refactor: change main query to use Donors model * chore: add Id Column to Donors List Table * chore: add Donor Information column to Donors List Table * fix: add label for deprecated status * chore: add Donation Count column to Donors List Table chore: add aria label * chore: add Latest Donation column to Donors List Table * refactor: add DonorType enum and replace where it's used * chore: add Donor Type column to Donors List Table * chore: add Date Created column to Donors List Table * refactor: remove additional emails from meta keys * refactor: add DonorModelQueryBuilder class * chore: attach additional emails to query results * fix: replace removed constant * feature: add value method to Query Builder * chore: add Donation Revenue column to Donors List Table * refactor: change method to use ModelQueryBuilder * refactor: bring additional_email meta key back to the ENUM class * chore: add unreleased tags * refactor: remove unused classes * chore: fix typo * refactor: change hooks to use Give ones * chore: add description to function * refactor: replace if statements with ternary operator * feature: add donor properties and * chore: revert * feature: add support for ->totalAmountDonated and ->totalNumberOfDonation in donor repository * feature: add new properties to factory * fix: flter out any null objects being returnd from query * tests: scaffold list donors first test * refactor: change additionalEmails query so that doesn't return null row * refactor: change columns to use the new properties * tests: add tests for donors list table * Epic Feature: Donor and Form table styles (#6610) * fix: update svg size and styles * fix: include additional status styles * feature: add no donation svg & styles * feature: add goal achieved star svg * fix: include form styles * feature: init Donation Form model scaffold * refactor: rename donation forms repository binding * feature: add initial DonationForms properties * feature: add methods to query data from database * doc: add docblocks to new methods * feature: connect query results to model * refactor: implement DonationFormLevel class * feature: implement values from database for $totalAmountDonated and $totalNumberOfDonations * refactor: implement DonationFormStatus class * feature: add method to create DonationFormLevel from a price string * feature: read price option and fill the model with the correct meta data * refactor: remove factory method while not yet implemented * tests: add tests for form model and dto with a new nifty legacy form adapter * refactor: move implementations from controller to endpoint class * feature: add DonationFormsListTable * refactor: change endpoint to make use of the new ListTable class * refactor: remove unused methods * feature: add TitleColumn to DonationFormsListTable * feature: add LevelsColumn to DonationFormsListTable * feature: change endpoints to support return an array of models * refactor: add return type to admin endpoint call args * feature: add DonationCountColumn to DonationFormsListTable coutcolumn * feature: add DonationRevenueColumn to DonationFormsListTable * feature: add ShortcodeColumn to DonationFormsListTable * feature: add DateCreatedColumn to DonationFormsListTable * feature: add StatusColumn to DonationFormsListTable * feature: add GoalColumn to DonationFormsListTable * feature: add support for sorting columns to DonationFormsListTable * fix: cast column to be sorted as number * tests: update DonationFormTest with new faux donation form model factory methods * Feature: Donation table Live/Test switch (#6613) * feature: add test toggle * feature: add toggle state * feature: include mode in table api * feature: update endpoint with mode * refactor: rename mode param to testMode * refactor: update naming conventions * fix: update styles * feature: include paymentgateway mode in donation window * feature: set initial testMode state to payment mode * refactor: pass toggle from donations table * fix: update test styles * fix: correct react hooks order warning * fix: update toggle * fix: update props * fix: remove unused imports * fix: add additional form styles * refactor: use only one conditional * refactor: move row actions to separate file for consistency * fix: simplify testmode styles * refactor: update testmode * refactor: change default value for testMode parameter Co-authored-by: Paulo Iankoski <[email protected]> * Feature/form UI subscriptions table endpoint (#6616) * feature: add test toggle * feature: add toggle state * feature: include mode in table api * feature: update endpoint with mode * refactor: rename mode param to testMode * refactor: update naming conventions * fix: update styles * feature: include paymentgateway mode in donation window * feature: set initial testMode state to payment mode * refactor: pass toggle from donations table * fix: update test styles * fix: correct react hooks order warning * fix: update toggle * fix: update props * fix: remove unused imports * fix: add additional form styles * refactor: use only one conditional * refactor: move row actions to separate file for consistency * fix: simplify testmode styles * refactor: update testmode * feature: add subscription table styles * feature: add subscriptions table * feature: add toggle * fix: remove unused import * test: add test for ListDonations endpoint * fix: replace controller with new endpoint class * refactor: rename endpoint class * test: add tests for ListDonationForms * refactor: remove unused preload methods * feature: register admin scripts * feature: init SubscriptionListTable with IdColumn on it * feature: register endpoints for Subscriptions * feature: append SubscriptionsListTable to GiveSubscriptions global * fix: pass a default currency value when nullable * test: add test for ListSubscriptions endpoint * feature: add labels to Value Object * feature: add new Columns to SubscriptionsListTable * feature: implement extra data for tooltip on StatusColumn * fix: update with subscription * refactor: remove invalid tests * fix:update testmodebadge * fix: update webpack * fix: update form filters * fix: add non breaking whitespace to status messages * Revert "fix: add non breaking whitespace to status messages" This reverts commit 61b2729. * fix: wrap tooltip content with a p tag * fix: pass payment mode to table * fix: update styles * fix: solve undefined index notice * fix: update font weight styles * refactor: change how migrations are registered for subscriptions * fix: update column size by table * feature: add subscription actions * fix: update expired bkg color * fix: update test filter * fix: replace margin with gap * fix: update failed status to failing * fix: update toggle size * feature: add payment_mode column to Subscriptions * fix: move handleItemSort * refactor: replace query loop with a single update query * fix: display by testModeFilter * fix: initialize as paymentMode * feature: save subscription payment mode when legacy payment gateway is used * refactor: rewrite endpoint hander to use the model * fix: add bulk delete * fix: fix donations bulk delete * feature: make form column sortable * feature: implement delete action on the subscriptions endpoint * doc: add missing unreleased tags * fix: update svg size * doc: add missing docblock * refactor: create model methods for conditionals Co-authored-by: Joshua Dinh <[email protected]> * Fix: Bulk checkboxes reset checked value after sorting (#6618) * fix: update preapproval label * fix: uncheck bulkaction checkbox when component unmounts * Fix: Limited subscription tooltip messages use correct nouns. (#6625) * fix:update failed message with bold text * fix: use _n function for singular vs plural * format: reformat code Co-authored-by: Paulo Iankoski <[email protected]> * Refactor/speed up endpoint performance (#6631) * refactor: replace endpoint request with direct query * refactor: remove other selects when counting * feature: add method to return an array of meta aliases based on a given array of ENUMs * refactor: replace prepareQuery on count methods of list endpoints with custom query * refactor: replace ModelQueryBuilder with QueryBuilder * refactor: remove unused namespaces * Fix/subscription payment mode column (#6633) * Refactor/speed up endpoint performance (#6635) * refactor: remove quote from having column name * refactor: keep existing columns on count as they may needed for group by * refactor: attach meta to donations count query only as needed * refactor: conditionally use having when there is another where clause * refactor: replace strings with ENUMs * doc: append array content type * Refactor/list table columns for addons (#6639) * refactor: rename getColumns function avoiding overwriting * refactor: add self return to methods * refactor: add parameter to method * Fix: Subscriptions renewed past their end date notify users of a potential error. (#6628) * feature: add over ran status for limited subscriptions * fix: update to failing svg * fix: add max width * fix: update placement of message for overrun * fix: update unreleased tag * fix: update terminology to exceed * Fix: New Donation table button added for users with the Manual Donations Add-on (#6638) * feature: add new donation button while manual donations add-on is active * fix: add unreleased tag * refactor: remove hasManualDonations * refactor: update with template literals * fix: remove boolean conversion * Fix: Loading animations are immediately visible regardless of page height (#6649) * feature: apply fixed styling to animation if page is scrollable * Fix: remove state changes * chore: remove duplicated css Co-authored-by: Paulo Iankoski <[email protected]> * fix: rename sortColumn value for donationsCount column * refactor: update test namespaces * tests: update tests after changes to DB statements * refactor: prevent migration of trying to add column twice Co-authored-by: alaca <[email protected]> Co-authored-by: Jason Adams <[email protected]> Co-authored-by: Joshua Dinh <[email protected]> Co-authored-by: Joshua Dinh <[email protected]> Co-authored-by: Jon Waldstein <[email protected]>
Description
Optimize list table endpoints performance replacing expensive queries with simple ones.
Affects
DonationsAdminPage.php
,DonorsAdminPage.php
andSubscriptionsAdminPage.php
there is a methodgetForms
that was triggering a request to the ListDonationForms endpoint what needed to load the entire model. We are replacing that request with a simple DB query returning only the necessary columns.count()
in a query it used to just appendCOUNT(*) as count
to the query then get that value from the results. We are now removing any other column from theSELECT
statement so that the query only results the count column.prepareQuery()
method but that attaches many extra meta data not necessary for the counting method. We are replacing theprepareQuery()
call with a customModelQueryBuilder
where only the necessary meta data for that endpoint is now being attached.Visuals
Database containing 3440 donations.
Pre-review Checklist
@unreleased
tags included in DocBlocks