Opened 11 years ago

Last modified 3 years ago

#728 in_progress defect

Collection page shows thumbnails in reverse order

Reported by: Kushal Kumaran Owned by: Boris Bobrov
Priority: major Milestone: 0.13.0
Component: programming Keywords: collections
Cc: ShawnRisk Parent Tickets:

Description

The collection page at /u/<username>/collection/<collection> shows thumbnails in order they were added. But the pagination link to go to the next page says "Older ->" implying that the thumbnails are being shown in reverse-created order.

Attachments (2)

show-collection-in-reverse-created-order.patch (1.5 KB ) - added by Kushal Kumaran 11 years ago.
patch that fixes the order
0001-Sort-collections-by-date-added.patch (1.2 KB ) - added by Olivier Mehani 5 years ago.

Download all attachments as: .zip

Change History (19)

by Kushal Kumaran, 11 years ago

patch that fixes the order

comment:1 by Kushal Kumaran, 11 years ago

Status: newreview

I have attached a patch that fixes the problem for me, following a suggestion on devel@. But my sqlalchemy-fu is pretty rudimentary, so someone more familiar will need to take a look.

comment:2 by rodney757, 11 years ago

Okay, so the reason it is backwards is because when you click on an item in a collection it actually takes you to the media page. When you click newer or older, it is just going through all the media that the user has uploaded, not just the media in that collection. I'm opening a ticket so that when you click on media from a collection, it only cycles through the collection instead of all the user's media.

That said I think you have the right idea for this for now. The whole order_col arg is unnecessary though, since the only other place that get_collection_items() is called is when deleting the collection. All you need to do is change the query and order_col = MediaEntry.created in get_collection_items().

Then I think this will be good to merge.

Thanks

comment:3 by rodney757, 11 years ago

Status: reviewaccepted

comment:4 by Boris Bobrov, 10 years ago

Status: acceptedreview

I wonder why it was not applied.
I've fixed it in my https://gitorious.org/mediagoblin/bretons-mediagoblin/, branch develop, so code review is required.

comment:5 by berkerpeksag, 10 years ago

Status: reviewaccepted

Sorry, I couldn't find the patch in both devel and develop branches. Could you point it out again?

comment:7 by Loic Dachary, 9 years ago

Status: acceptedreview

comment:8 by Boris Bobrov, 8 years ago

Wow, cool. Merging this since i have commit rights now!

comment:9 by Boris Bobrov, 8 years ago

fixed in dbb86ff

comment:10 by Boris Bobrov, 8 years ago

Resolution: fixed
Status: reviewclosed

comment:11 by Boris Bobrov, 8 years ago

Reopening because of 9d935dd

comment:12 by Boris Bobrov, 8 years ago

Resolution: fixed
Status: closedaccepted

comment:13 by Boris Bobrov, 8 years ago

Owner: set to Boris Bobrov
Priority: minormajor
Status: acceptedin_progress

comment:14 by Ben Sturmfels, 8 years ago

Cc: R13ose added

Updating at Amelia Rose's request:

The reason for re-open was that the change introduced a bug as described in #5469:

"InvalidRequestError: Could not find a FROM clause to join from.  Tried joining to <class 'mediagoblin.db.models.MediaEntry'>, but got: Can't find any foreign key relationships between 'core__collection_items' and 'core__media_entries'."

breton reverted this patch in 9d935dd, so it now needs a new patch that fixes the issue without introducing further issues.

comment:15 by Ben Sturmfels, 8 years ago

Cc: ShawnRisk added; R13ose removed

by Olivier Mehani, 5 years ago

comment:16 by Olivier Mehani, 5 years ago

I still have the problem to date, and I think I just found the root cause. See the comment in the attached patch. tl;dr: I think it's because the ordering is relying on a position attribute that is never set. Using the date added instead returns the items sorted as desired.

comment:17 by Ben Sturmfels, 3 years ago

Milestone: 0.13.0
Note: See TracTickets for help on using tickets.