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

Paginable actions not working on templates pages #1495

Closed
briri opened this issue May 16, 2018 · 11 comments
Closed

Paginable actions not working on templates pages #1495

briri opened this issue May 16, 2018 · 11 comments
Assignees
Labels
bug effort-small less than 1/2 day of dev time templates

Comments

@briri
Copy link
Contributor

briri commented May 16, 2018

The search and sort functions are not working on the templates pages: owned and customizable (when there are more than 10 templates in the list).

Clicking on sorts or search results in which seems to be an issue with the chaining of scopes:
``ActiveRecord::StatementInvalid - Mysql2::Error: Unknown column 'orgs.name' in 'order clause': SELECT templates.* FROM `templates` WHERE `templates`.`archived` = 0 AND `templates`.`published` = 1 AND `templates`.`family_id` IN (1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1894, 1895, 1896, 1903, 1907, 1911, 1912, 1932, 1936, 1940, 1941, 1947, 1949, 1950, 1951, 1952, 1953, 1962, 1964, 1965, 1971, 1977, 1979, 1984, 1986, 1992, 1993, 2000, 2001, 2005, 2008, 2009, 2016, 2019, 538382351, 756435778, 1936) AND `templates`.`visibility` = 1 ORDER BY orgs.name ASC LIMIT 10 OFFSET 0:```

@briri briri added bug templates effort-small less than 1/2 day of dev time labels May 16, 2018
jollopre added a commit to DigitalCurationCentre/roadmap that referenced this issue May 17, 2018
@jollopre jollopre mentioned this issue May 17, 2018
@jollopre jollopre self-assigned this May 17, 2018
@sjDCC
Copy link
Contributor

sjDCC commented May 17, 2018

This seems to work fine for dates and template names but the funder column wouldn't sort for me and the 'customise status' list was still a bit jumbled post-sorting. I expanded to a full view of 33 items btw. Not sure if that will have affected this.
capture

@jollopre
Copy link
Contributor

@sjDCC I sent a PR #1511 before that solves the problem when attempting to sort by 'funder' or org however it is still pending to be reviewed/deployed...

@stephaniesimms
Copy link

I can sort by all columns except Status. The Status column does sort properly when I test as a Super Admin only for the "All templates" tab but not the other two tabs. It doesn't sort for either tab when I test as an Org admin.

And now the search function is no longer working for a list of more than 10 items in the same pattern described for Status column sorting above. I can create a new issue for this bug if it should be handled separately?

@briri
Copy link
Contributor Author

briri commented May 17, 2018

No, its likely related. All of those links fire Javascript. An unfortunate side-effect of many javascript failures is that all remaining javascript on the page stops working. I think its probably what's happening.

What steps did you take to create the issue? Click sort on the status column and then search?

@stephaniesimms
Copy link

i was toggling across tabs so no particular order to produce the issue with Status sort and Search. Every time I test them in whatever order neither works.

@jollopre
Copy link
Contributor

@stephaniesimms, @sjDCC the status column that we see in the UI table does not 'always' correspond to the status (published attribute) stored in the db table. At the database level, that attribute only captures 0 (non-published) and 1 (published), however we enhance it logically by adding three more statuses:

  • Draft (a template version created after a published one)
  • Non Customised (a funder template that an org never customised)
  • Original funder template has changed (a funder template has a newer published version that a customised template did not port over those changes)

and that's the reason the sorting or search seems to not work adequately, although it purely does.

I suggest to keep the status as it is, i.e. a boolean condition and add next to it an icon that provides further information (draft, non-customised, original funder template has changed) when logically it does. What do you think?

@sjDCC
Copy link
Contributor

sjDCC commented May 18, 2018

That makes sense. Thanks @jollopre

Yes, keeping just two statuses and introducing icons like we are doing elsewhere would be good

@briri
Copy link
Contributor Author

briri commented May 18, 2018

Will fix as part of #1507 when I switch the column status to the binary Published/Unpublished.

@briri
Copy link
Contributor Author

briri commented May 18, 2018

@sjDCC and @stephaniesimms we are not going to be able to sort on the Status column at this time. We can revisit in #1235. The pagination logic only allows for simple database ordering and published is either true or false. A draft is unpublished in the database (one of its prior versions is published) but we display the label 'Published' on the page, so it will not sort correctly until we allow for more complex logic.

@briri briri closed this as completed May 18, 2018
@stephaniesimms
Copy link

not sorting on Status column is fine for now. I discovered that I can filter by status if I select the tallies "Published" "Unpublished" above each table, which is great. Tallies and sorting are all working nicely now.

Fine to close this issue and I'll create a new bug issue for Search not working on the customizable templates tab.

@sjDCC
Copy link
Contributor

sjDCC commented May 22, 2018

All sounds good

briri added a commit to CDLUC3/dmptool that referenced this issue May 23, 2018
This commit is a complete refactor of all the pages involved with Template creating/editing. The database, models, controllers, views and JS have all been changed.

------------------------------------------------------------

removed unused template methods from Plan model and removed references to 'Dmptemplate' from tests

started updating model scopes and began creating new unit tests and test_helper methods

Rebased with template customization fixes. updated tests and latest_version queries

Grouping class methods. Grouping scope methods into separate class

removed Template::valid scope method in favour of Template::unarchived

Moved class methods to scope rails flavour.

Removed Template::get_public_published_template_versions method

Model#deep_copy instead of Model::deep_copy. Model#deep_copy without side effects

added customize method to model

updated customize to use new deep_copy and added some tests

fixed test

fixed broken tests after latest PR. DMPRoadmap#1341

generate_version with unit test associated

customize with unit test associated

upgrade_customization first attempt

added tests for upgrade_customization

upgrade_customization with several unit test associated

added generate_copy

fixed tests and added test_helper for phase/section/question/annotation/question_option equality for verifying template copy/version/customize

added comments

finished up tests

Removed template.update! in favour of a more re-usable deep_copy with atomic saving.

removed new_copy.save! from templates_controller#copy. Atomic save for upgrade_customization method

renamed to bang notation generate_copy, generate_version, customize and upgrade_customization

question mark methods for generate_version, customize and upgrade_customization

unique indices for template and template customisations. DMPRoadmap#1341

init functionality for versionable concern

updated errors, added get_new

unique indices for template and template customisations. DMPRoadmap#1341

new schema dump generated from rails

manually set up the default for org.links

Fix for rake tasks

updated template controller and tests

finished tests for template controller update http verbs for customize and copy methods

updated template versioning intgeration to use new test_helper methods

updated template controller and tests

finished tests for template controller update http verbs for customize and copy methods

updated template versioning intgeration to use new test_helper methods

wired in the new versionable concern

wired in the new versionable concern

updated query structure in template_filter

updated routes and paths

moved phases controller to org_admin namespace

changes to phase model and unit tests

started moving phase views to new org_admin namespace and tests

fixed tests

started fixing up references to moved plan/phase status

started fixing up references to moved plan/phase status

moved js file, fixed tests and manually checked pages

set schema.rb back to sprint2

added in versionable concern and fixed tests

removed unused phase_status method

removed test for phase_status method

fixed issue with template visibility for the default template

fixed issue with default templates and versioning/customization

versionable_test.rb

versionable concern updated

find_or_generate_version! into template, test associated

annotation and question model using has_one through adequately

templates_controller#update action refactored

tweaks to template_test

get_new and get_modifiable test cases for RuntimeError capture

passing parent object ids to children during deep_copy

updated question_option and annotation deep copy

removed old deep_copy method from section model and updated unit tests

removed old deep_copy method from section model and updated unit tests

updates to sections controller, model, routes and tests

fixed broken tests

updated both phases and sections controller to use versionable

fixed tests

started work on new template show/edit

finished up templates UI

fixed tests

consolidated form

consolidated form

fixed history page

removed old view

fixed test

fixed typo in en_US app.po

removed old deep_copy method from section model and updated unit tests

updates to sections controller, model, routes and tests

fixed broken tests

updated both phases and sections controller to use versionable

fixed tests

fixed tests and missing policy

fixed tests

created separate routes for each template index tab

updates to template index page structure

added callback to template model to ensure only one published version

finished up first pass of templates index page

fixed tests

removed current_tab from phase views. DMPRoadmap#1407

section#create refactored. DMPRoadmap#1407

sections loaded on demand for a phase. DMPRoadmap#1407

ExpandAll triggers click instead of using collapse. DMPRoadmap#1407

added phase/section/question overview back to template details page

send customizer to show section page

updated button text

updated history controller action

updated controller

updated views

added customization distinction to page title

updates to phase/section to introduce referrer logic and added section-show for customizable

removed old 'edit phase details button

removed edit question partial from section show

tweaks to templates index pages

fixed tests and default scope

added test for default customizations

added namespace to org section of templates index and made autocomplete combobox aware of form namespace

fixed issue with container view

removed old policies

updated statuses of templates

fixed typo in phases/overview view. DMPRoadmap#1377

annotations moved to org_admin namespace. DMPRoadmap#1377

annotations_controller#(create|update|destroy) with test associated. DMPRoadmap#1377

flash notice for successful action carried out. DMPRoadmap#1377

flash notice for success actions. create? method for annotation policy. DMPRoadmap#1377

started refactor of sections/questions

fixed nil references. DMPRoadmap#1462

annotations as fields_for nested attributes. DMPRoadmap#1462

commented out version check on template update

removed invalid test

fixed reference to moved partials and family to family_id

fixed question update

updated guidances to work with modified themes form

finished up questions

fixed broken tests

updated preview and customize

fixed issue with sections index

cleaned up remaining issues with template editing and customization

added in check for nil phase to sections create

any user with readable rights should see download tab for a plan. DMPRoadmap#1483

updated history to use new template.draft? logic to determine when to show draft icon

added latest check

added check for default option

added checks for historical and customization on preview page

added redirect to show if template is customization

added redirect to show if template is customization

updated ajax success/error for section display

fixed issues with create plan template selection and changing plan visibility

forgot to include model change

reverted schema.rb changes

adding org to chained scope in order to have searchable and sortable templates. DMPRoadmap#1495

improved customization template search against all funder templates. DMPRoadmap#1499

started work on adding edit/show/new/cancel buttons for questions

added toggle functionality between question show/edit

removed whitespace

made text area the default

updated template statuses

updated class to fix layout

introducing event delegation for sections/questions/annotations. DMPRoadmap#1502

removed console.log

fixed JS for section/question

annotation loading tinymce when section show only permits customisation. DMPRoadmap#1502

fixed issue with customizating by adding a section/question

removed reload

set focus to first invalid form input

fixed placement of focus for new validation.js

Added joins for customizations table

updated query

fixed initial numbering for new phases/sections

reverted referrer change

made section fields required

added ariatise to new section form

fixed referrer check

fixed inconsistent status message for transfer customization workflow

fixed issue with csv download

fixed csv header

fixed links for customization on history page

updated sections index so new section doesn't show unless its the current template

Added joins for customizations table

added includes to customisable query

fixed issue with paginable history

fixed merge conflicts in templates_controller and questions/_show.html.erb

resolved additional rebase conflict
xsrust pushed a commit to DigitalCurationCentre/roadmap that referenced this issue Jun 14, 2018
This commit is a complete refactor of all the pages involved with Template creating/editing. The database, models, controllers, views and JS have all been changed.

------------------------------------------------------------

removed unused template methods from Plan model and removed references to 'Dmptemplate' from tests

started updating model scopes and began creating new unit tests and test_helper methods

Rebased with template customization fixes. updated tests and latest_version queries

Grouping class methods. Grouping scope methods into separate class

removed Template::valid scope method in favour of Template::unarchived

Moved class methods to scope rails flavour.

Removed Template::get_public_published_template_versions method

Model#deep_copy instead of Model::deep_copy. Model#deep_copy without side effects

added customize method to model

updated customize to use new deep_copy and added some tests

fixed test

fixed broken tests after latest PR. DMPRoadmap#1341

generate_version with unit test associated

customize with unit test associated

upgrade_customization first attempt

added tests for upgrade_customization

upgrade_customization with several unit test associated

added generate_copy

fixed tests and added test_helper for phase/section/question/annotation/question_option equality for verifying template copy/version/customize

added comments

finished up tests

Removed template.update! in favour of a more re-usable deep_copy with atomic saving.

removed new_copy.save! from templates_controller#copy. Atomic save for upgrade_customization method

renamed to bang notation generate_copy, generate_version, customize and upgrade_customization

question mark methods for generate_version, customize and upgrade_customization

unique indices for template and template customisations. DMPRoadmap#1341

init functionality for versionable concern

updated errors, added get_new

unique indices for template and template customisations. DMPRoadmap#1341

new schema dump generated from rails

manually set up the default for org.links

Fix for rake tasks

updated template controller and tests

finished tests for template controller update http verbs for customize and copy methods

updated template versioning intgeration to use new test_helper methods

updated template controller and tests

finished tests for template controller update http verbs for customize and copy methods

updated template versioning intgeration to use new test_helper methods

wired in the new versionable concern

wired in the new versionable concern

updated query structure in template_filter

updated routes and paths

moved phases controller to org_admin namespace

changes to phase model and unit tests

started moving phase views to new org_admin namespace and tests

fixed tests

started fixing up references to moved plan/phase status

started fixing up references to moved plan/phase status

moved js file, fixed tests and manually checked pages

set schema.rb back to sprint2

added in versionable concern and fixed tests

removed unused phase_status method

removed test for phase_status method

fixed issue with template visibility for the default template

fixed issue with default templates and versioning/customization

versionable_test.rb

versionable concern updated

find_or_generate_version! into template, test associated

annotation and question model using has_one through adequately

templates_controller#update action refactored

tweaks to template_test

get_new and get_modifiable test cases for RuntimeError capture

passing parent object ids to children during deep_copy

updated question_option and annotation deep copy

removed old deep_copy method from section model and updated unit tests

removed old deep_copy method from section model and updated unit tests

updates to sections controller, model, routes and tests

fixed broken tests

updated both phases and sections controller to use versionable

fixed tests

started work on new template show/edit

finished up templates UI

fixed tests

consolidated form

consolidated form

fixed history page

removed old view

fixed test

fixed typo in en_US app.po

removed old deep_copy method from section model and updated unit tests

updates to sections controller, model, routes and tests

fixed broken tests

updated both phases and sections controller to use versionable

fixed tests

fixed tests and missing policy

fixed tests

created separate routes for each template index tab

updates to template index page structure

added callback to template model to ensure only one published version

finished up first pass of templates index page

fixed tests

removed current_tab from phase views. DMPRoadmap#1407

section#create refactored. DMPRoadmap#1407

sections loaded on demand for a phase. DMPRoadmap#1407

ExpandAll triggers click instead of using collapse. DMPRoadmap#1407

added phase/section/question overview back to template details page

send customizer to show section page

updated button text

updated history controller action

updated controller

updated views

added customization distinction to page title

updates to phase/section to introduce referrer logic and added section-show for customizable

removed old 'edit phase details button

removed edit question partial from section show

tweaks to templates index pages

fixed tests and default scope

added test for default customizations

added namespace to org section of templates index and made autocomplete combobox aware of form namespace

fixed issue with container view

removed old policies

updated statuses of templates

fixed typo in phases/overview view. DMPRoadmap#1377

annotations moved to org_admin namespace. DMPRoadmap#1377

annotations_controller#(create|update|destroy) with test associated. DMPRoadmap#1377

flash notice for successful action carried out. DMPRoadmap#1377

flash notice for success actions. create? method for annotation policy. DMPRoadmap#1377

started refactor of sections/questions

fixed nil references. DMPRoadmap#1462

annotations as fields_for nested attributes. DMPRoadmap#1462

commented out version check on template update

removed invalid test

fixed reference to moved partials and family to family_id

fixed question update

updated guidances to work with modified themes form

finished up questions

fixed broken tests

updated preview and customize

fixed issue with sections index

cleaned up remaining issues with template editing and customization

added in check for nil phase to sections create

any user with readable rights should see download tab for a plan. DMPRoadmap#1483

updated history to use new template.draft? logic to determine when to show draft icon

added latest check

added check for default option

added checks for historical and customization on preview page

added redirect to show if template is customization

added redirect to show if template is customization

updated ajax success/error for section display

fixed issues with create plan template selection and changing plan visibility

forgot to include model change

reverted schema.rb changes

adding org to chained scope in order to have searchable and sortable templates. DMPRoadmap#1495

improved customization template search against all funder templates. DMPRoadmap#1499

started work on adding edit/show/new/cancel buttons for questions

added toggle functionality between question show/edit

removed whitespace

made text area the default

updated template statuses

updated class to fix layout

introducing event delegation for sections/questions/annotations. DMPRoadmap#1502

removed console.log

fixed JS for section/question

annotation loading tinymce when section show only permits customisation. DMPRoadmap#1502

fixed issue with customizating by adding a section/question

removed reload

set focus to first invalid form input

fixed placement of focus for new validation.js

Added joins for customizations table

updated query

fixed initial numbering for new phases/sections

reverted referrer change

made section fields required

added ariatise to new section form

fixed referrer check

fixed inconsistent status message for transfer customization workflow

fixed issue with csv download

fixed csv header

fixed links for customization on history page

updated sections index so new section doesn't show unless its the current template

Added joins for customizations table

added includes to customisable query

fixed issue with paginable history

fixed merge conflicts in templates_controller and questions/_show.html.erb

resolved additional rebase conflict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug effort-small less than 1/2 day of dev time templates
Projects
None yet
Development

No branches or pull requests

4 participants