From 806f3df376fefba0078fe30f734c632c5f65390d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Klatt?= Date: Wed, 10 Feb 2016 11:29:22 +0100 Subject: [PATCH] round PMs to quarters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Torbjörn Klatt --- _data/visits.yml | 4 ++-- _plugins/duration_tag.rb | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/_data/visits.yml b/_data/visits.yml index 1a27879a..c4723ed4 100644 --- a/_data/visits.yml +++ b/_data/visits.yml @@ -6,7 +6,7 @@ - from: haensel_d to: balaji_p start: 2016-02-04 - end: 2016-02-15 + end: 2016-02-8 - from: haensel_d to: balaji_p @@ -16,4 +16,4 @@ - from: haensel_d to: balaji_p start: 2015-12-04 - end: 2016-01-15 + end: 2016-01-25 diff --git a/_plugins/duration_tag.rb b/_plugins/duration_tag.rb index 9e630d7d..10a6f7a5 100644 --- a/_plugins/duration_tag.rb +++ b/_plugins/duration_tag.rb @@ -1,3 +1,9 @@ +class Float + def round_quarter + (self * 4).round / 4.0 + end +end + module Jekyll module Tags class DurationTagError < StandardError @@ -40,7 +46,7 @@ def days_from_seconds(context) class DurationPMsTag < DurationTag def render(context) days = days_from_seconds(context) - "#{(days / 30.0).round(2)} PM" + "#{(days / 30.0).round_quarter} PM" end end