From 9aac271b605c78567e3ac3d03ec511e23d8f5cec Mon Sep 17 00:00:00 2001 From: Tobias Leugger Date: Sat, 9 Mar 2013 20:06:53 +0100 Subject: [PATCH] Improving readability of the statements for setting the colour of a task --- src/app/tasks.coffee | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/app/tasks.coffee b/src/app/tasks.coffee index 16d17257b7..2d3aa66b94 100644 --- a/src/app/tasks.coffee +++ b/src/app/tasks.coffee @@ -14,14 +14,20 @@ module.exports.view = (view) -> else classes += " uncompleted" - switch - when value<-20 then classes += ' color-worst' - when value>=-20 and value<-10 then classes += ' color-worse' - when value>=-10 and value<-1 then classes += ' color-bad' - when value>=-1 and value<1 then classes += ' color-neutral' - when value>=1 and value<5 then classes += ' color-good' - when value>=5 and value<10 then classes += ' color-better' - when value>=10 then classes += ' color-best' + if value < -20 + classes += ' color-worst' + else if value < -10 + classes += ' color-worse' + else if value < -1 + classes += ' color-bad' + else if value < 1 + classes += ' color-neutral' + else if value < 5 + classes += ' color-good' + else if value < 10 + classes += ' color-better' + else + classes += ' color-best' return classes module.exports.app = (appExports, model) -> @@ -135,9 +141,9 @@ module.exports.app = (appExports, model) -> data = google.visualization.arrayToDataTable matrix options = { - title: 'History' - #TODO use current background color: $(el).css('background-color), but convert to hex (see http://goo.gl/ql5pR) - backgroundColor: 'whiteSmoke' + title: 'History' + #TODO use current background color: $(el).css('background-color), but convert to hex (see http://goo.gl/ql5pR) + backgroundColor: 'whiteSmoke' } chart = new google.visualization.LineChart(document.getElementById( chartSelector ))