DMPRoadmap / roadmap

DCC/UC3 collaboration for a data management planning tool
MIT License
102 stars 109 forks source link

Customized template not appearing as customized in Templates tab #1345

Closed briri closed 6 years ago

briri commented 6 years ago

Please complete the following fields as applicable:

Expected behaviour: Customizing a template results in 'Unpublished changes' in the 'Customized table' tab

Actual behaviour: After customizing an existing template the 'Customized table' tab still shows 'Not customized'. It is working though for new templates

Steps to reproduce: Customize an existing template in DMPOnline and then go back to the Admin -> Templates page and view the row on the 'Customizable templates' table.

Issue appears to be coming from this method: https://github.com/DMPRoadmap/roadmap/blob/67edbda193ff2ad7412c972c12bd927b2ad72094/app/models/template.rb#L130

Which is called by this filter (included on the paginable/templates_controller.rb): https://github.com/DMPRoadmap/roadmap/blob/67edbda193ff2ad7412c972c12bd927b2ad72094/lib/template_filter.rb#L3

briri commented 6 years ago

@jollopre and @vyruss you will need to look into this one since we cannot replicate it with our DMPTool data. I've highlighted the code that populates the 'Customizable Templates' table. The issue could also be happening on the template clone as well though since its grabbing data from the original template and this does not happen if the templates are new.

jollopre commented 6 years ago

@briri, @vyruss The source of the problem originates at Template.customization_of_with_max_version since it is grabbing the max version for each template whose customization_of is a dmptemplate_id of another template (e.g. funder for this case). This generic query can bring a template for another org if the version is higher but would be filtered down later on by Template.latest_customization.

I believe we can also replicate this on your data if you do the following:

  1. Customize a funder template with an org X
  2. Change org X to org Y
  3. Customize the same funder template with org Y
  4. Create different versions for that customized funder template with org Y
  5. Change to org X again and your customization is no longer accessible through the Customized templates tab

The PR #1351 should fix the problem, but anyway please test it from your side too.

stephaniesimms commented 6 years ago

working as expected now on roadmap stage. closing issue.

sjDCC commented 6 years ago

I've found a bug on this. Re-opening but perhaps it should be a new ticket?

Multiple unis can add annotations but when one does, it displays the warning that the funder template has been updated to others... It hasn't thought. It's just another uni doing a customisation.

bug

I added example answers to the Sloan template for UCSD and American Uni

briri commented 6 years ago

Hmm. Lets move this back to in Progress then so that we remember to recheck it. I think the changes @jollopre have been making to the templates code may address this issue. If multiple Unis customize a funder template it should create individual template versions for them so that adding things like annotations or new sections to one customized template should not affect this status message of related customized templates. Only changes to the base funder template should cause this status message to change.

stephaniesimms commented 6 years ago

consensus to wait for template versioning work to be completed. this is related issue and may be fixed afterward. transfer customizations workflow is also a separate issue.

sjDCC commented 6 years ago

Ok, since this is a separate issue and will be handled later I have created a new ticket. It's #1390