From 20b40b195aa89778a8b6dc22f76a2ea76ef406a8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Feb 2018 09:49:40 +0100 Subject: Handle user rates in real time --- client/src/app/shared/video/video-details.model.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'client/src/app/shared/video') diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts index a22ed68da..1882a8165 100644 --- a/client/src/app/shared/video/video-details.model.ts +++ b/client/src/app/shared/video/video-details.model.ts @@ -60,8 +60,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { this.support = hash.support this.commentsEnabled = hash.commentsEnabled - this.likesPercent = (this.likes / (this.likes + this.dislikes)) * 100 - this.dislikesPercent = (this.dislikes / (this.likes + this.dislikes)) * 100 + this.buildLikeAndDislikePercents() } getAppropriateMagnetUri (actualDownloadSpeed = 0) { @@ -90,4 +89,9 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { isUpdatableBy (user: AuthUser) { return user && this.isLocal === true && (this.accountName === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) } + + buildLikeAndDislikePercents () { + this.likesPercent = (this.likes / (this.likes + this.dislikes)) * 100 + this.dislikesPercent = (this.dislikes / (this.likes + this.dislikes)) * 100 + } } -- cgit v1.2.3