-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Secondarily order campaign dashboard by id #15316
Conversation
(Standard links)
|
CRM/Campaign/BAO/Campaign.php
Outdated
@@ -399,6 +399,7 @@ public static function getCampaignSummary($params = [], $onlyCount = FALSE) { | |||
if ($orderOnCampaignTable) { | |||
$orderByClause = "ORDER BY campaign.{$sortParams['sort']} {$sortParams['sortOrder']}"; | |||
} | |||
$orderByClause .= ", campaign.id {$sortParams['sortOrder']}"; |
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.
On line 365 above $orderByClause
is declared as NULL, so this concatenation would need to be conditional on it actually containing some value.
@mepps Can you action comments please? |
Finally had a chance to update this! Not sure if the logic is the cleanest way to write it. |
@eileenmcnaughton or @mattwire could you merge this PR? |
Overview
If multiple campaigns are added quickly, they are sorted on start date. However, they can get out of order, because start date rounds up to the nearest minute. This could confuse users and just looks funny. This patch adds a secondary order by on id for any campaign list query, taking the sort order from the params.
Before
The ordering is unclear because all start dates are the same.
After
It sorts by id after start date.
Note that it still sorts correctly by start date if they vary.
Technical Details
If the PR introduces noteworthy technical changes, please describe them here. Provide code snippets if necessary
Comments
Anything else you would like the reviewer to note