This is complicated to understand but I really will do my best at explaining what i'm trying to do.
I need help in trying to figure out how to achieve a result. Not necessarily the code to do it but working out the steps I need to take.
I have a set of Photos on Flickr. They are organised (using Flickr's terminology) into PhotoSets and Collections.
An example Structure:
DEMO 1:
2023 (Collection)
- Trip 1 (Collection)
- Day 1 (PhotoSet)
- Day 2 (PhotoSet)
- Day 3 (PhotoSet)
- Day 4 (PhotoSet)
- Day 5 (PhotoSet)
- Trip 2 (Collection)
- Day 1 (PhotoSet)
- Day 2 (PhotoSet)
- Day 3 (PhotoSet)
- Miscellaneous (Collection)
- Random Day out 1 (PhotoSet)
- Random Day out 2 (PhotoSet)
- Random Day out 3 (PhotoSet)
- Random Day out 4 (PhotoSet)
This is fine, BUT in my Rails app, I have a gallery that i'm working on and i'd like to display Collections and some Photosets at the same level. The PhotoSets that should be displayed at the same level are those in the "Miscellaneous" Collection.
This is fine up until now. I've written a script to import this data into my app and I use my own terminology here (Collections and PhotoAlbums).
As part of the import script, if a Collection has the name "Miscellaneous", I don't create a Collection and just create the PhotoAlbums it contained and I set the parent of them to the previous parent. The local hierarchy then looks like:
DEMO 2:
2023 (Collection)
- Trip 1 (Collection)
- Day 1 (PhotoAlbum)
- Day 2 (PhotoAlbum)
- Day 3 (PhotoAlbum)
- Day 4 (PhotoAlbum)
- Day 5 (PhotoAlbum)
- Trip 2 (Collection)
- Day 1 (PhotoAlbum)
- Day 2 (PhotoAlbum)
- Day 3 (PhotoAlbum)
- Random Day out 1 (PhotoAlbum)
- Random Day out 2 (PhotoAlbum)
- Random Day out 3 (PhotoAlbum)
- Random Day out 4 (PhotoAlbum)
The problem then starts here:
It turns out that i'd like these to be displayed in chronological order. I'll mark the order using letters:
DEMO 3:
2023 (Collection)
- Trip 1 (Collection)
- Day 1 (PhotoAlbum) C
- Day 2 (PhotoAlbum) D
- Day 3 (PhotoAlbum) E
- Day 4 (PhotoAlbum) F
- Day 5 (PhotoAlbum) G
- Trip 2 (Collection)
- Day 1 (PhotoAlbum) I
- Day 2 (PhotoAlbum) J
- Day 3 (PhotoAlbum) K
- Random Day out 1 (PhotoAlbum) A
- Random Day out 2 (PhotoAlbum) B
- Random Day out 3 (PhotoAlbum) H
- Random Day out 4 (PhotoAlbum) L
Therefore I wish to end up with a hierarchy in my app like:
DEMO 4:
2023 (Collection)
- Random Day out 1 (PhotoAlbum) A
- Random Day out 2 (PhotoAlbum) B
- Trip 1 (Collection)
- Day 1 (PhotoAlbum) C
- Day 2 (PhotoAlbum) D
- Day 3 (PhotoAlbum) E
- Day 4 (PhotoAlbum) F
- Day 5 (PhotoAlbum) G
- Random Day out 3 (PhotoAlbum) H
- Trip 2 (Collection)
- Day 1 (PhotoAlbum) I
- Day 2 (PhotoAlbum) J
- Day 3 (PhotoAlbum) K
- Random Day out 4 (PhotoAlbum) L
On Flickr, I can pull a list of all my PhotoSets and they are in A-L order, but when I pull through the hierarchy, it returns them as in my first demo list.
This would all not be necessary if Flickr allowed us to put Collections AND PhotoSets at the same level but alas they don't.
What I need help with is how to transition from DEMO 2 to DEMO 4.
I'm not really sure what else to add. I've done my best to explain my problem as clearly and efficiently as possible. I'd like to see how people suggest I go about resolving this and coming up with a solution.