rondog Posted February 25, 2009 Share Posted February 25, 2009 I am building a 5 star rating system in flash. I have a bunch of videos that people can rate 1-5. My question is what is the math that calculates the average of all the votes to give me a 1-5 value? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/146923-solved-rating-system/ Share on other sites More sharing options...
premiso Posted February 25, 2009 Share Posted February 25, 2009 Sum all the votes together then divide that by the number of votes. Quote Link to comment https://forums.phpfreaks.com/topic/146923-solved-rating-system/#findComment-771339 Share on other sites More sharing options...
The Little Guy Posted February 25, 2009 Share Posted February 25, 2009 Something like this: round(Total_Vote / Total_Numer_Votes,2); // Total_Vote is the sum of all the votes for the video // Total_Number_Votes is the sum of how many people voted on the video Quote Link to comment https://forums.phpfreaks.com/topic/146923-solved-rating-system/#findComment-771344 Share on other sites More sharing options...
rondog Posted February 25, 2009 Author Share Posted February 25, 2009 edit::wait I think i get it.. Quote Link to comment https://forums.phpfreaks.com/topic/146923-solved-rating-system/#findComment-771348 Share on other sites More sharing options...
rondog Posted February 25, 2009 Author Share Posted February 25, 2009 ahh ok I get it. I was counting each 1-5 star more like a tally rather than the actual value of the star Quote Link to comment https://forums.phpfreaks.com/topic/146923-solved-rating-system/#findComment-771351 Share on other sites More sharing options...
The Little Guy Posted February 25, 2009 Share Posted February 25, 2009 no 3 people vote: (2, 4, 3) sum = 9 so it would look like this: round(9 / 3,2); Quote Link to comment https://forums.phpfreaks.com/topic/146923-solved-rating-system/#findComment-771354 Share on other sites More sharing options...
rondog Posted February 25, 2009 Author Share Posted February 25, 2009 got it thanks guys! Quote Link to comment https://forums.phpfreaks.com/topic/146923-solved-rating-system/#findComment-771366 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.