HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Question about rating/ikes...

Login / Search

 [ Join | More ]
 Add topic 
Posted
Item has a rating of 5 (Liked by Jean)  
Rating:
#91876 (In Topic #18454)
Avatar

Community saint

I'm working on something that totals up all the 'ikes' someone get's.   Clearly any given like is in tabel cop_rating, and that list's the type of content rated, and the ID of that number.    

I'm not sure if I want to just count up likes for posts, or if it should count up likes for all content… so out of curiosity, what other 'rating_for_types' are there?   

Also, I'm doing this only for the event that 'ratings as ikes' is set, as I don't want to deal with calculating out averages and such…

So far I have found the quickest way to return the # of likes a person as received for posts, a SQL join:

Code

SELECT * FROM ocp_rating as r JOIN ocp_f_posts as p ON r.rating_for_id=p.id WHERE p.p_poster=x AND rating=10

of course, I don't need to return *, but just for testing I was.  x would be the ID of the person you want to get this info for.   rating=10 is because ratings are stored as 1 to 10…. a 10 is a 'like', a '1' is a dislike… but I don't want to deal with dislikes… maybe down the road, but probably not as there is no reason to deal with or show negative things like that.

So my question to Chris is what other 'types' are there (and which might be add-on stuff?), and to everyone else, is would you want total likes, or just posts, or the ability to call up total for each of  the 'types'?

BTW, Jean, I just realized, this all will make it's way into the rewards addon, probably as a method for total likes given on the system, as well as total likes for each type on their own.    Hopefully you use 'ikes' rather than straight ratings, as I don't know how I'd deal with that… though I suppose I might be able to figure that out. ;)     I like killing many birds with one stone….

Paul
Back to the top
 
Posted
Rating:
#91887
Avatar

Community saint

Dunno how the ratings work but thought I'd offer my 2 cent's here in case it helps with forumlating your POA (Plan of Action hehe). But this would be a good example of an area where (and why) I was suggesting that third field in the reward table. 1. Method 2.Value 3. Extra Params so you could just make the method a little more generic (for arguements sake let's call it  reward_likes).

That method can now take the value (most likes or 10 likes whatever?) and from extra params field take what those likes are for - All, Posts, Blogs, News etc. (think of the Extra Params in this case the "Where" you'd use in your query).

Just a 2cents in case it helps in planning.
Back to the top
 
Posted
Rating:
#91902
Avatar

So my question to Chris is what other 'types' are there (and which might be add-on stuff?), and to everyone else,

Look in the sources/hooks/systems/content_meta_aware/*.php files, for values of 'feedback_type_code'.

Increasingly these hook files are becoming the skeleton for tieing different parts of the system together and allowing automated processing. In the v10 development branch they have already been merged with awards hooks.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#91973
Avatar

Community saint

Ah, thanks.  From searching through all the code, it seems seedy_post is also used but that doesn't come from the files above you listed.

Question related to all of this, most of it is pretty straight forward so far… but I'm wondering about news/blogs…

Obviously if either is liked it goes in as 'news' for type.   I can go join with the news table on id an d submitter to see who got the like.  No problem t here.  

But how do I figure out if that news entry is a news entry or a blog?

At first look it seems I can pull news_category from the record in the news table, use that with the news_categories table to pull out nc_owner.

It looks like if news_categories.nc_owner = news.news_category then it is a blog, if it is NULL then it is system owned and thus news.

But I am a bit unsure, as i seem to recall options that let users create categories…   

Figured I'd ask the pro…

Thanks

Paul
Back to the top
 
Posted
Rating:
#91982
Avatar

You're right


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: