Tech Support Posted July 30, 2017 Share Posted July 30, 2017 Rating in KVS is a number from 0 to 5 due to historical reasons. Initially it was a 5-star rating where users could vote not just as "like" or "dislike", but also use other rating values. In modern themes almost everybody is using likes or dislikes. So do KVS themes. However internally the rating is still calculated as a plain number, where "like" is a 5-star vote and "dislike" is a 0-star vote. By default rating is displayed as % amount of likes using this code: Inside list block (means for each video / album / model / etc. in the list): {{assign var="rating" value="`$item.rating/5*100`"}} {{if $rating>100}}{{assign var="rating" value="100"}}{{/if}} {{$rating}}% Inside view block: {{assign var="rating" value="`$data.rating/5*100`"}} {{if $rating>100}}{{assign var="rating" value="100"}}{{/if}} {{$rating}}% If you want to change this with the number of likes and dislikes, or show them additionally to % rating, you can use this code: Inside list block (means for each video / album / model / etc. in the list): {{assign var="likes" value=0}} {{assign var="dislikes" value=0}} {{if $item.rating>0}} {{assign var="likes" value=$item.rating*$item.rating_amount/5|replace:",":"."|round}} {{assign var="dislikes" value=$item.rating_amount-$likes}} {{/if}} {{$likes}} likes and {{$dislikes}} dislikes Inside view block: {{assign var="likes" value=0}} {{assign var="dislikes" value=0}} {{if $data.rating>0}} {{assign var="likes" value=$data.rating*$data.rating_amount/5|replace:",":"."|round}} {{assign var="dislikes" value=$data.rating_amount-$likes}} {{/if}} {{$likes}} likes and {{$dislikes}} dislikes 2 Quote Link to comment Share on other sites More sharing options...
Tanjiro Posted March 19, 2023 Share Posted March 19, 2023 (edited) I see user can't change like or dislike once they chose, it's said "IP already voted" . How to fix that ? Edited March 19, 2023 by Tanjiro Quote Link to comment Share on other sites More sharing options...
Tech Support Posted March 19, 2023 Author Share Posted March 19, 2023 5 hours ago, Tanjiro said: I see user can't change like or dislike once they chose, it's said "IP already voted" . How to fix that ? This is not possible in KVS. We will probably fix that when come to migrating rating to the nextgen architecture, for now it is still using the old code. 1 Quote Link to comment Share on other sites More sharing options...
Tanjiro Posted March 21, 2023 Share Posted March 21, 2023 (edited) On 3/19/2023 at 6:48 PM, Tech Support said: This is not possible in KVS. We will probably fix that when come to migrating rating to the nextgen architecture, for now it is still using the old code. I hope you can include feature that can change up vote/down vote in comment section too in next update Edited March 21, 2023 by Tanjiro Quote Link to comment Share on other sites More sharing options...
Tech Support Posted March 21, 2023 Author Share Posted March 21, 2023 5 hours ago, Tanjiro said: I hope you can include feature that can change up vote/down vote in comment section too in next update For now it is not about the next update, but yes, when we come to moving rating \ comments to the nextgen API, we will solve all questions and issues that have been collected during the long time for these topics. 1 Quote Link to comment Share on other sites More sharing options...
Tanjiro Posted February 12 Share Posted February 12 On 7/30/2017 at 12:18 PM, Tech Support said: Rating in KVS is a number from 0 to 5 due to historical reasons. Initially it was a 5-star rating where users could vote not just as "like" or "dislike", but also use other rating values. In modern themes almost everybody is using likes or dislikes. So do KVS themes. However internally the rating is still calculated as a plain number, where "like" is a 5-star vote and "dislike" is a 0-star vote. By default rating is displayed as % amount of likes using this code: Inside list block (means for each video / album / model / etc. in the list): {{assign var="rating" value="`$item.rating/5*100`"}} {{if $rating>100}}{{assign var="rating" value="100"}}{{/if}} {{$rating}}% Inside view block: {{assign var="rating" value="`$data.rating/5*100`"}} {{if $rating>100}}{{assign var="rating" value="100"}}{{/if}} {{$rating}}% If you want to change this with the number of likes and dislikes, or show them additionally to % rating, you can use this code: Inside list block (means for each video / album / model / etc. in the list): {{assign var="likes" value=0}} {{assign var="dislikes" value=0}} {{if $item.rating>0}} {{assign var="likes" value=$item.rating*$item.rating_amount/5|replace:",":"."|round}} {{assign var="dislikes" value=$item.rating_amount-$likes}} {{/if}} {{$likes}} likes and {{$dislikes}} dislikes Inside view block: {{assign var="likes" value=0}} {{assign var="dislikes" value=0}} {{if $data.rating>0}} {{assign var="likes" value=$data.rating*$data.rating_amount/5|replace:",":"."|round}} {{assign var="dislikes" value=$data.rating_amount-$likes}} {{/if}} {{$likes}} likes and {{$dislikes}} dislikes I'm sorry but can you be more specific? Where can I change from percentage to number likes and dislike like this Quote Link to comment Share on other sites More sharing options...
Tech Support Posted February 13 Author Share Posted February 13 In Website UI -> Pages -> View Video page -> video_view block template. 1 Quote Link to comment 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.
Note: Your post will require moderator approval before it will be visible.