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

Issue with ordering of data on Summary page #4257

Closed
ebruchez opened this issue Nov 1, 2019 · 0 comments
Closed

Issue with ordering of data on Summary page #4257

ebruchez opened this issue Nov 1, 2019 · 0 comments

Comments

@ebruchez
Copy link
Collaborator

@ebruchez ebruchez commented Nov 1, 2019

With a MySQL table with 21K+ rows, sorting/paging on the Summary page doesn't aways show correctly. I paste below the SQL query which runs:

SELECT c.*,
       t.control,
       t.pos,
       t.val
FROM (
         SELECT c.*,
                @rownum := @rownum + 1 row_num
         FROM (select @rownum := 0) r,
              (
                  SELECT DISTINCT c.data_id
                  FROM orbeon_i_current c
                  WHERE c.app = 'orbeon'
                    AND c.form = 'register'
                    AND c.form_version = 1
                    AND c.draft = 'N'
              ) s
                  INNER JOIN
              orbeon_i_current c
              ON c.data_id = s.data_id
         ORDER BY c.last_modified_time DESC
     ) c
         LEFT JOIN
     orbeon_i_control_text t
     ON t.data_id = c.data_id
WHERE row_num
          BETWEEN 1
          AND 10

Withtout the last WHERE row_num part, I observe that the first rows returned go in descending last_modified_time, as expected. However, the row_num column also goes in descending order. Therefore, adding WHERE row_num between 1 and 10 doesn't return the latest 10 rows,
but the oldest 10 rows. So this appears wrong. See the following screenshot.

$ mysqld --version
mysqld  Ver 5.7.27-0ubuntu0.18.04.1 for Linux on x86_64 ((Ubuntu))

Screen Shot 2019-11-01 at 10 32 55 AM

@ebruchez ebruchez added this to To do in Orbeon Forms 2019.1.1 via automation Nov 1, 2019
@avernet avernet closed this in 5afc434 Nov 1, 2019
Orbeon Forms 2019.1.1 automation moved this from To do to Done Nov 1, 2019
avernet added a commit that referenced this issue Nov 1, 2019
@avernet avernet added this to Done in Orbeon Forms 2019.2 Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.