sciencehistory / chf-sufia

sufia-based hydra app
Other
9 stars 4 forks source link

"sort alphabetically" and drag and drop functionality not working in file manager #1206

Closed yonyitz closed 5 years ago

yonyitz commented 5 years ago

When clicking on "File Manager" then "sort alphabetically" and "save," when you return to the record, the changes are not saved. This functionality also does not work when dragging and dropping the image into the correct order and clicking save.

It seems something similar appeared in point #2 of this ticket that was closed: https://github.com/sciencehistory/chf-sufia/issues/896

jrochkind commented 5 years ago

Please give the specific IDs of the works you were working on. This does work for some works at some times (I just verified it worked for me in a random one on staging), so it may be particular characteristics of the particular works involved that trigger the bug.

yonyitz commented 5 years ago

Thanks, @jrochkind ! I was working on this record https://digital.sciencehistory.org/works/5d86p139h and was attempting to move filename 2007.509_037 (last image) in numerical order.

yonyitz commented 5 years ago

Here is another record where the sort function is not working:

https://digital.sciencehistory.org/works/cc08hg69n

yonyitz commented 5 years ago

This is another record that needs sorting:

https://digital.sciencehistory.org/works/vt150k323

eddierubeiz commented 5 years ago

So here's my current understanding:

For now, I've sorted 'Polygraphice' and 'Physical apparatus' correctly by filename. The hidden characters are still in there. See e.g. https://staging.digital.sciencehistory.org/concern/file_sets/cc08hg70d and inspect the HTML. Note the title is actually "b1036401_001.tif". As for the Woodward seminar, I'm happy to help sort it; just let me know which pages are out of order.

eddierubeiz commented 5 years ago

@yonyitz, if it's OK with you, I'd like to close this ticket, unless we can verify there's another problem not described above. By the way, if we want to remove these weird zero-width no-break spaces from fileset titles, we can totally do that, but that should probably be another ticket.

yonyitz commented 5 years ago

@eddierubeiz working on the lecture note issue and will be in touch with my findings in case it requires your help. Will be in touch!

yonyitz commented 5 years ago

Okay; I've figured out that https://digital.sciencehistory.org/works/q237hs87b should follow https://digital.sciencehistory.org/works/v692t719s. The filenames indicate the correct order placement. The titles do not reflect order. The drag/drop sort feature still does not work. Hope that all makes sense!

eddierubeiz commented 5 years ago

So there were two things wrong with the Woodward seminar ( the tech notes below are mostly for me and @jrochkind for future reference. )

To fix this:

1) I added the wayward child back:

parent = GenericWork.find('5d86p139h')
child = GenericWork.find('q237hs87b')
parent.members <<  child
parent.ordered_members <<  child
parent.save!

2) I removed the nil items from parent.ordered_members:

parent.ordered_members == parent.ordered_members.to_a.compact

Now we can drag and drop the items around and the results are saved correctly.

eddierubeiz commented 5 years ago

To summarize all the notes above, the following problems can cause trouble with sorting child items in Sufia: