From 4597f97cf2020f900f36af2867d1129d9bebd54d Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 24 Mar 2017 11:28:36 +0500 Subject: Format speed in notification templates --- templates/mail/deviceOverspeed.vm | 8 +++++--- templates/sms/deviceOverspeed.vm | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'templates') diff --git a/templates/mail/deviceOverspeed.vm b/templates/mail/deviceOverspeed.vm index 3b203ddcd..0715a3d60 100644 --- a/templates/mail/deviceOverspeed.vm +++ b/templates/mail/deviceOverspeed.vm @@ -1,10 +1,12 @@ #set($subject = "$device.name: exceeds the speed") #if($speedUnits == 'kmh') -#set($speedString = $position.speed * 1.852 + ' km/h') +#set($speedValue = $position.speed * 1.852) +#set($speedString = $numberTool.format("0.0 km/h", $speedValue)) #elseif($speedUnits == 'mph') -#set($speedString = $position.speed * 1.15078 + ' mph') +#set($speedValue = $position.speed * 1.15078) +#set($speedString = $numberTool.format("0.0 mph", $speedValue)) #else -#set($speedString = "$position.speed kn") +#set($speedString = $numberTool.format("0.0 kn", $position.speed)) #end diff --git a/templates/sms/deviceOverspeed.vm b/templates/sms/deviceOverspeed.vm index 3c9eae628..ef0d9d955 100644 --- a/templates/sms/deviceOverspeed.vm +++ b/templates/sms/deviceOverspeed.vm @@ -1,8 +1,10 @@ #if($speedUnits == 'kmh') -#set($speedString = $position.speed * 1.852 + ' km/h') +#set($speedValue = $position.speed * 1.852) +#set($speedString = $numberTool.format("0.0 km/h", $speedValue)) #elseif($speedUnits == 'mph') -#set($speedString = $position.speed * 1.15078 + ' mph') +#set($speedValue = $position.speed * 1.15078) +#set($speedString = $numberTool.format("0.0 mph", $speedValue)) #else -#set($speedString = "$position.speed kn") +#set($speedString = $numberTool.format("0.0 kn", $position.speed)) #end $device.name exceeds the speed $speedString at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) -- cgit v1.2.3