Hi, I am having trouble with sorting and was wondering if anyone can help. I have albums as entities & tracks within albums as field collections. I have fivestar enabled on both and it works perfectly:

Album 1: 8.5/10 (Track A: 3.5/10, Track B: 4.5/10)
Album 2: 9.5/10 (Track C: 5.5/10, Track D: 6.5/10)

I was able to successfully create a view titled "Top rated albums" using a relationship ("Content: Vote results") & sort criteria ("(Vote results) Vote results: Value (desc)"):

Album 2: 9.5/10
Album 1: 8.5/10

But when I try to create a view titled "Top rated tracks" using relationships ("Field collection item: Entity with the Track Listing (field_collection)" & "(field_collection) Content: Vote results") & sort criteria ("(Vote results) Vote results: Value (desc)"), it sorts based on top rated albums instead of tracks no matter what I do:

Track C: 5.5/10 (Album 2: 9.5/10) -> Should be Track D: 6.5/10
Track D: 6.5/10 (Album 2: 9.5/10) -> Should be Track C: 5.5/10
Track A: 3.5/10 (Album 1: 8.5/10) -> Should be Track B: 4.5/10
Track B: 4.5/10 (Album 1: 8.5/10) -> Should be Track A: 3.5/10

The value type ("Percent"), vote tag ("vote") & aggregate function ("Average vote") are of course set correctly, just like the successful view for albums. Am I missing something here?

Comments

jmuzz’s picture

Issue summary: View changes
Status: Active » Fixed

Make sure it's a view that displays field collection items and not nodes. Add the relationship, and require the relationship. Then when you add the sort criteria you should see the option to use the relationship or not. Choose to not use the relationship as it will prioritize the version of the field in the host if you use the relationship in the sort criteria.

jay.lee.bio’s picture

Thanks. I'm currently doing this in a different way, but I'll look at your answer the next time I do something similar.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.