Skip to content

Fix random order inconsistencies#7437

Merged
mrcasals merged 4 commits intodecidim:developfrom
mainio:fix/random-order-inconsistencies
Feb 23, 2021
Merged

Fix random order inconsistencies#7437
mrcasals merged 4 commits intodecidim:developfrom
mainio:fix/random-order-inconsistencies

Conversation

@ahukkanen
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen commented Feb 22, 2021

🎩 What? Why?

There seems to be a consistent issue over the random ordering of records that has had multiple attempts to be fixed in the past (see related issues). The issue still persist.

There seems to be two separate issues related to this as far as I could identify:

  1. The random seed is not properly stored in the session variable as I believe was the intention
  2. The random order calculation at PostgreSQL can be inconsistent in case any of the the ordered table's records are changed during the user session as explained at Add default order by ID to API list queries #7424.

This fixes both of these issues:

  1. The first issue is quite trivial, the value never got stored into the session bag, so fix that.
  2. The second issue adds the record IDs as the "base" numbers for the random ordering which should provide more consistent results.

📌 Related Issues

Testing

Describe the best way to test or validate your PR.

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

Copy link
Copy Markdown
Contributor

@mrcasals mrcasals left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG yayyyyyy ❤️

@mrcasals mrcasals added module: core type: fix PRs that implement a fix for a bug labels Feb 23, 2021
@mrcasals mrcasals merged commit eb32cd4 into decidim:develop Feb 23, 2021
@ahukkanen ahukkanen deleted the fix/random-order-inconsistencies branch February 23, 2021 08:54
entantoencuanto added a commit that referenced this pull request Feb 25, 2021
* develop: (232 commits)
  Add Votings to Open Data export (#7388)
  Add order in not highlighted assemblies by weight (#7444)
  Resort Menus (#7460)
  Polling Officer Zone (#7439)
  Fix session timeout when using multiple windows or tabs (#7459)
  Fix display of debates with multiple dates (#7393)
  chore: split election tests (#7451)
  style: make selected values primary labels with delete button (#7448)
  Fix and tests to avoid registered users being invited again (#7392)
  Migrate Admin menus to Menu Registry (#7368)
  New Crowdin updates (#7338)
  Bump to carrierwave 2.2.0 (#7441)
  Voting: show callout when Polling Stations miss Polling Officers (#7417)
  Further default orders for the API (#7436)
  Fix random order inconsistencies (#7437)
  Ensure Rails is locked to 5.2.4.x series (#7430)
  Add default order by ID to API list queries (#7424)
  Update dependencies (#7422)
  Ignore warning on CI when no artifacts to upload (#7420)
  Filter and search polling officers (#7411)
  ...
ahukkanen added a commit to City-of-Helsinki/decidim-helsinki that referenced this pull request Aug 13, 2021
Port the following core PR to the instance:
decidim/decidim#7437
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: core type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants