Skip to content
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

Merged
merged 3 commits into from
Feb 19, 2020

Conversation

mepps
Copy link
Contributor

@mepps mepps commented Sep 17, 2019

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.
CampaignDashboard-Before

After

It sorts by id after start date.
image

Note that it still sorts correctly by start date if they vary.
image

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

@civibot civibot bot added the master label Sep 17, 2019
@civibot
Copy link

civibot bot commented Sep 17, 2019

(Standard links)

@@ -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']}";
Copy link
Member

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.

@mattwire
Copy link
Contributor

@mepps Can you action comments please?

@mepps
Copy link
Contributor Author

mepps commented Nov 15, 2019

Finally had a chance to update this! Not sure if the logic is the cleanest way to write it.

@jaapjansma
Copy link
Contributor

  • General standards
    • Explain (r-explain)
      • PASS : The problem could have been explained better. However it does not block the review of this PR.
    • User impact (r-user)
      • PASS: The change would be intuitive.
    • Documentation (r-doc)
      • PASS: The changes do not require documentation.
    • Run it (r-run)
      • PASS: We have tested the campaign dashboard with all kind of sortings and it all worked as expected.
  • Developer standards
    • Technical impact (r-tech)
      • PASS: The change preserves compatibility with existing callers/code/downstream.
    • Code quality (r-code)
      • PASS: The functionality, purpose, and style of the code seems clear+sensible.
      • COMMENTS: I did not really understand the statement added but it looks good to me.
    • Maintainability (r-maint)
      • PASS: The change is trivial enough that it does not require tests.
    • Test results (r-test)
      • PASS: The test results are all-clear.

@eileenmcnaughton or @mattwire could you merge this PR?

@mattwire mattwire merged commit d36fcd1 into civicrm:master Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants