diff options
author | deva <deva> | 2009-02-18 16:11:59 +0000 |
---|---|---|
committer | deva <deva> | 2009-02-18 16:11:59 +0000 |
commit | 243a21d6ee5d377fa2f19f2552fdf583ccc29bb3 (patch) | |
tree | 2e757b4395655c87bade07f51e684044e2ea9d4d /server/xml/macros | |
parent | 74c69254be1bf8ac2d3e535efb54d3a62b95145d (diff) |
Made fuzzyclock interpretation in B.2.1.3. Added B.2.1.3 to amd_kontrolunders template.
Diffstat (limited to 'server/xml/macros')
-rw-r--r-- | server/xml/macros/B.2.1.3.xml | 45 |
1 files changed, 42 insertions, 3 deletions
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}</resume> 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') "> |