Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Support floats #285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions templates/project/widgets/number/number.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ class Dashing.Number extends Dashing.Widget

@accessor 'difference', ->
if @get('last')
last = parseInt(@get('last'))
current = parseInt(@get('current'))
last = parseFloat(@get('last'))
current = parseFloat(@get('current'))
if last != 0
diff = Math.abs(Math.round((current - last) / last * 100))
"#{diff}%"
Expand All @@ -13,7 +13,7 @@ class Dashing.Number extends Dashing.Widget

@accessor 'arrow', ->
if @get('last')
if parseInt(@get('current')) > parseInt(@get('last')) then 'icon-arrow-up' else 'icon-arrow-down'
if parseFloat(@get('current')) > parseFloat(@get('last')) then 'icon-arrow-up' else 'icon-arrow-down'

onData: (data) ->
if data.status
Expand Down