Skip to content
This repository has been archived by the owner on Jun 30, 2020. It is now read-only.

LIBITD-993 Make reports index table sortable #177

Open
wants to merge 2 commits into
base: release/2.1.0
Choose a base branch
from

Conversation

cfitz
Copy link
Contributor

@cfitz cfitz commented Nov 9, 2018

This allows sorting on the reports index table.

https://issues.umd.edu/browse/LIBITD-993

@dsteelma-umd
Copy link
Contributor

Review comments:

There are several problems with this implementation:

  1. The implementation does not follow the sorting paradigm in the other pages of providing a "Reset sorting" link to clear the current sort. This means that once a user selects a field to sort, they can't sort exclusively on another field – the sort for the first field is always taken into account. The only way to clear the sort is to reset the page by selecting the "Reports" entry from the dropdown menu (or clearing the sort params from the URL in the address bar).

  2. The fields do not display the up/down sort arrows by default as on other pages.

  3. Multi-sorting fields can lead to an error. For example, go to the "Reports" page and select the following fields in order:

    Name
    Format
    Creator
    Created At

And "ActiveRecord::StatementInvalid" error will be displayed:

ActiveRecord::StatementInvalid in Reports#index

Showing /Users/dsteelma/work/github/annual-staffing-request/app/views/reports/index.html.erb where line #26 raised:

SQLite3::SQLException: ambiguous column name: created_at: SELECT  "reports"."id" AS t0_r0, "reports"."output" AS t0_r1, "reports"."parameters" AS t0_r2, "reports"."format" AS t0_r3, "reports"."status" AS t0_r4, "reports"."name" AS t0_r5, "reports"."user_id" AS t0_r6, "reports"."created_at" AS t0_r7, "reports"."updated_at" AS t0_r8, "reports"."status_message" AS t0_r9, "users"."id" AS t1_r0, "users"."cas_directory_id" AS t1_r1, "users"."name" AS t1_r2, "users"."created_at" AS t1_r3, "users"."updated_at" AS t1_r4, "users"."admin" AS t1_r5 FROM "reports" LEFT OUTER JOIN "users" ON "users"."id" = "reports"."user_id" ORDER BY reports.name desc, format desc, users.name desc, created_at desc LIMIT ? OFFSET ?

Given these issues, and time constraints, this issue is being reopened, will likely not be in the v2.1.0 release.

This adds the table name to the created_at since joins can cause
problems with the sorting.

https://issues.umd.edu/browse/LIBITD-993
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants