Updated progress bar to use new predictions

This commit is contained in:
Brenda Wallace
2017-10-29 15:10:12 +13:00
parent 202f557e32
commit b90b4e42fb
2 changed files with 4 additions and 9 deletions

View File

@@ -2,18 +2,13 @@
- if show_explanation == true
Progress: 0% - not planted yet
= render "plantings/progress_bar", status: "not planted", progress: 0
- elsif planting.finished?
- if show_explanation == true
Progress: 100%
= render "plantings/progress_bar", status: 'finished', progress: 100
- elsif planting.days_before_maturity.nil?
- elsif planting.finish_predicted_at.nil?
- if show_explanation == true
Progress: Not calculated, days before maturity unknown
Progress: Not enough data
= render "plantings/progress_bar", status: "unknown", progress: nil
- else
- if show_explanation == true
Progress: #{planting.percentage_grown}%
= render "plantings/progress_bar", status: 'growing', progress: planting.percentage_grown

View File

@@ -5,7 +5,7 @@
-# haml-lint:disable InlineStyles
%div{ class: "progress-bar progress-bar-#{status}", role: "progressbar", style: "width: #{progress}%" }
- if progress >= 30
#{progress}%
#{sprintf '%.2f', progress}%
- if progress < 30
#{progress}%
#{sprintf '%.2f', progress}%
-# haml-lint:enable InlineStyles