rating

PostgreSQL: five stars rating, ordering objects

孤街醉人 提交于 2019-12-24 19:53:26
问题 In my database users can add a vote from 1 to 5 stars to every groups. Then I have to display a leaderboard by those votes. What I was doing until now is to order them by votes average without a weight. This is not so nice because a group having 5.0 with 20 votes is before of a group having 4.9 avg and 10000 votes. This is my votes table: CREATE TABLE IF NOT EXISTS votes( user_id BIGINT, group_id BIGINT, vote SMALLINT, vote_date timestamp, PRIMARY KEY (user_id, group_id) This is how I sort

how to control target in a multiple jquery raty system

蹲街弑〆低调 提交于 2019-12-24 13:33:31
问题 I'm using jquery raty to do a rating page in php, where multiple rating are displayed. It works ok unless one thing. The score function, and the click function works ok. But I'm having problems trying to set the target for each element. What I want is to show the rating choice on hover over each star. It should show the hint in the div with class "star_hint", but it isn't. Each element is displayed in a div like this: <div class="span4"> <h4>First valoration</h4> <div class="star" data-number

Assign places in the rating (MySQL, PHP)

 ̄綄美尐妖づ 提交于 2019-12-24 12:08:18
问题 I have a MySQL database with the following columns: id company rating_score rating_place I have companies and rating scores for each company. So, my db looks like: id company rating_score rating_place 75 Intel 356.23 34 Sun 287.49 etc. How can I assign the places (my rating_place column is empty) based on the score using php and mysql? Thank you! 回答1: How about this: update mytable set rating_place =(select count(*)+1 from mytable intb where intb.rating_score>mytable.rating_score) ----edit

Replace star ratings in Woocommerce using hooks

只愿长相守 提交于 2019-12-24 08:07:26
问题 when enabled, every woocommerce product has a star rating. I have some custom code that I would like to replace the current star rating in its entirety (Including the "# customer reviews" part. Currently, the code I am using only appends to the star rating, rather than replace it fully. Below is the current result I am seeing, and the code I have added to functions.php. Thank you in advance. Code: add_filter( 'woocommerce_get_star_rating_html', 'replace_star_ratings' ); function replace_star

K2_content module rating

扶醉桌前 提交于 2019-12-23 17:24:35
问题 I've been reconstructing the standard K2 rating in the category_item.php to view ratings from to show as stars to show as number. What I did was, I replaced this code: <?php if($this->item->params->get('catItemRating')): ?> <div id="catItemRatingBlock"> <div class="itemRatingForm"> <ul class="itemRatingList"> <li class="itemCurrentRating" id="itemCurrentRating<?php echo $this->item->id; ?>" style="width:<?php echo $this->item->votingPercentage; ?>%;"></li> <li><a href="#" rel="<?php echo

MySQL Rating System - Find Rating

家住魔仙堡 提交于 2019-12-23 03:17:26
问题 I'm trying to rate Types of Fruit by the best possible rating given by users. I have a Fruit table called Ratings just for submitting ratings with the following Information Fruit_id int From_ID int Rating int now I'm trying to run a SQL command like the following select From_ID, AVG(Rating) AS Rating FROM Ratings Group BY `Fruit_ID` ORDER by Rating DESC This works however, if i get 1 user who rates a fruit an apple a 5, and then 1000 users who rate an orange a 4 the apple is suddenly

Add a product review with ratings programmatically in Woocommerce

喜你入骨 提交于 2019-12-23 02:32:27
问题 The title says it all. I know the reviews are the native comments post type in Wordpress. I have included the code to add a comment. The problem is however I am unclear how to give the comment a rating and how to tie it to a particular product. When I use the comment_post_ID it does not seem to be assigning the comment (review) to the correct post. $time = current_time('mysql'); $data = array( 'comment_post_ID' => 1, 'comment_author' => 'admin', 'comment_author_email' => 'admin@admin.com',

MySQL 5-star rating datatype?

旧巷老猫 提交于 2019-12-22 06:47:59
问题 Would ENUM('1','2','3','4','5') be a sensible datatype for a product rating which must be between 1 and 5? Thanks! 回答1: Yes, that would be an appropriate data type since it enforces your domain. If you are going to add (or do any other mathematical operation) them together, however, a numeric data type might be better. 回答2: I suggest using TINYINT UNSIGNED NOT NULL or, for better ANSI/SQL compatibility, use: SMALLINT NOT NULL With an integer type, it is much easier to do calculations. ENUM is

Simple like/dislike rating system in php and MySQL

久未见 提交于 2019-12-21 05:41:31
问题 I want to add a simple rating system to my random video site (id = youtube id) I don't have much experience with php and MySQL and I'm not sure how to update a field using submit buttons in this way: <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" name"rateform"> <input name="rateup" type="image" src="up.png" id="rateup" value="rateup" /> <input name="ratedown" type="image" src="down.png" id="ratedown" value="ratedown" /> </form> <?PHP mysql_connect(",",",",",")or die(mysql

Django Comments and Rating Systems

穿精又带淫゛_ 提交于 2019-12-21 05:37:14
问题 I am looking for a blogging and comments system that can smoothly integrate with my Django sites. I've found there is a lot on the Net and got lost a bit, and I don't have much experience on this. Hope you guys can give me some suggestions. Here are the things that I would like to have: Tag Clouds Articles Archive (by months/by years) Articles Rating (e.g. with Stars or customize icons) Comments to the particular Topic/Articles Sub-Comments of a particular comments (i.e. following up comments