From 243a21d6ee5d377fa2f19f2552fdf583ccc29bb3 Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 18 Feb 2009 16:11:59 +0000 Subject: Made fuzzyclock interpretation in B.2.1.3. Added B.2.1.3 to amd_kontrolunders template. --- server/xml/macros/B.2.1.3.xml | 45 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'server/xml/macros') diff --git a/server/xml/macros/B.2.1.3.xml b/server/xml/macros/B.2.1.3.xml index 3459538..fa2871a 100644 --- a/server/xml/macros/B.2.1.3.xml +++ b/server/xml/macros/B.2.1.3.xml @@ -31,9 +31,48 @@ ${current_eye_disease} formatlanguage="lua" format= " - return os.date('%e. %b %Y', tonumber(getValue('date'))) - .. ' - På ' .. getValue('eye')..' øje er der observeret ' - .. getValue('observeret') .. '. Symptomerne er opstået ' + days = (os.time() - tonumber(getValue('date'))) / (60 * 60 * 24) + num = 0 + identifier = '' + suffix = '' + + if(num == 0 and math.floor(days/7) == 0) + then + num = days + identifier = 'dag' + suffix = 'e' + end + + if(num == 0 and math.floor(days/31) == 0) + then + num = days / 7 + identifier = 'uge' + suffix = 'r' + end + + if(num == 0 and math.floor(days/365) == 0) + then + num = days / 31 + identifier = 'måned' + suffix = 'er' + end + + if(num == 0) + then + num = days / 365 + identifier = 'år' + suffix = '' + end + + num = math.floor(num * 2) / 2 + if(num == 1) + then + suffix = '' + end + + return 'På ' .. getValue('eye')..' øje har der været ' + .. getValue('observeret') .. ' igennem ' .. num .. ' ' + .. identifier .. suffix .. '. Symptomerne er opstået ' .. getValue('when') .. ' og er efterfølgende ' ..getValue('then') "> -- cgit v1.2.3