Hello all,
I'm trying to create a View to list all the reviews for a given node, but with a given value. For instance: listing all the fivestars reviews for a node.

This means I need to relate {nodereviews} - {votingapi_vote}, but since the relationship is based in two keys (reviewed-node-id + user-id), how would you advise to approach this?

1) Could a 2-key-relationship be predefined in nodereview_views_data()?
hook_views_data only provides a single key relationship example.
Could you please point to any example of a custom 'views_handler_relationship'?

2) Would it be easier to try to provide the vote-value for the review as a Field with a custom 'views_handler_filter_numeric'? Any example at hand?

This would need to go through a View, since I'd like to plug the resulting View to a chart, to get an amazon-like review histogram.

Probably I'm missing some basic point, and this is not as complex as it seems to me.
Thanks in advance for any hints or directions!!

Comments

oscardax’s picture

Other option would be to add a column to {nodereviews_reviews} to explicitly bind the review with the vote casted.

This is what {fivestar_comment} does to rate a node from the comment form: {fivestars_comment} has one column binding the comment_id [cid], a 2nd column for the vote id [vote_id], and as well a 3rd one with the numeric value of the the vote casted [value]. I don't know if this may be regarded as introducing redundancy in the DB, but could be an option.

Any thoughts?

yaworsk’s picture

I'd be hesitant to introduce additional db fields to accomplish this. I can't remember what currently exists but i would think views filters would be the best way to handle thing, filter any nodereview that isn't the value you are looking for.

worst case, right now, you could always hook into views to define the functionality you are looking for an immediate fix...

pete

danielhonrade’s picture

Status: Active » Fixed

check on table wizard, gets all tables and you can put relationships, then views will automatically get these tables with relationship, cool.

Status: Fixed » Closed (fixed)

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