From 84c8fb9b99e0f5690f4cd0de825f261d31347b34 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sat, 3 Mar 2018 15:10:56 -0600 Subject: [PATCH] Separate with comma views, likes, dislikes --- src/helpers.cr | 4 ++++ src/views/watch.ecr | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/helpers.cr b/src/helpers.cr index b3625b67..d0b6feec 100644 --- a/src/helpers.cr +++ b/src/helpers.cr @@ -320,3 +320,7 @@ def template_comments(root) return html end + +def number_with_separator(number) + number.to_s.reverse.gsub(/(\d{3})(?=\d)/, "\\1,").reverse +end diff --git a/src/views/watch.ecr b/src/views/watch.ecr index 1e15c156..4e75cc7e 100644 --- a/src/views/watch.ecr +++ b/src/views/watch.ecr @@ -81,9 +81,9 @@ function dismiss(target) {
-

<%= video.views %>

-

<%= video.likes %>

-

<%= video.dislikes %>

+

<%= number_with_separator(video.views) %>

+

<%= number_with_separator(video.likes) %>

+

<%= number_with_separator(video.dislikes) %>

Wilson Score : <%= video.wilson_score.round(4) %>

Rating : <%= rating.round(4) %> / 5

Engagement : <%= engagement.round(2) %>%