From db0c60be0df9c42486232cb4095eecdd229772b5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 23 Apr 2018 13:33:38 +1200 Subject: [PATCH] Rename zombie to super_late --- app/assets/stylesheets/overrides.sass | 4 ++-- app/helpers/plantings_helper.rb | 2 +- app/models/concerns/predict_planting.rb | 3 ++- app/views/plantings/_badges.html.haml | 6 +++--- config/locales/en.yml | 2 +- spec/features/gardens/gardens_index_spec.rb | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/overrides.sass b/app/assets/stylesheets/overrides.sass index 920dbd5d4..3c44ffa62 100644 --- a/app/assets/stylesheets/overrides.sass +++ b/app/assets/stylesheets/overrides.sass @@ -115,12 +115,12 @@ p.stats .progress border-radius: 0 -.badge-zombie +.badge-super-late background-color: $red .badge-harvest background-color: $blue -.planting-zombie +.planting-super-late .planting-predicted-finished background-color: $beige diff --git a/app/helpers/plantings_helper.rb b/app/helpers/plantings_helper.rb index b57a1dc4a..dd96ce5fa 100644 --- a/app/helpers/plantings_helper.rb +++ b/app/helpers/plantings_helper.rb @@ -49,7 +49,7 @@ module PlantingsHelper classes << 'planting-finished' if planting.finished? classes << 'planting-harvest-time' if planting.harvest_time? classes << 'planting-predicted-finished' if planting.should_be_finished? - classes << 'planting-zombie' if planting.zombie? + classes << 'planting-super-late' if planting.super_late? classes.join(' ') end end diff --git a/app/models/concerns/predict_planting.rb b/app/models/concerns/predict_planting.rb index 006f51ed6..9cc0e5521 100644 --- a/app/models/concerns/predict_planting.rb +++ b/app/models/concerns/predict_planting.rb @@ -58,7 +58,8 @@ module PredictPlanting crop.annual? && planted_at.present? && finish_predicted_at.present? end - def zombie? + # Planting has live more then 90 days past predicted finish + def super_late? should_be_finished? && (finish_predicted_at + 90.days) < Time.zone.today end diff --git a/app/views/plantings/_badges.html.haml b/app/views/plantings/_badges.html.haml index cb2019374..561a22538 100644 --- a/app/views/plantings/_badges.html.haml +++ b/app/views/plantings/_badges.html.haml @@ -1,7 +1,7 @@ // Finish times - if planting.finish_is_predicatable? - - if planting.zombie? - %span.badge.badge-zombie= t('.zombie') + - if planting.super_late? + %span.badge.badge-super late= t('.super late') - if can? :edit, planting = render 'shared/buttons/finish_planting', planting: planting - elsif !planting.should_be_finished? @@ -10,7 +10,7 @@ = t('.days_until_finished') // Harvest times -- unless planting.zombie? +- unless planting.super_late? - if planting.harvest_time? %span.badge.badge-harvest= t('.harvesting_now') - elsif planting.before_harvest_time? diff --git a/config/locales/en.yml b/config/locales/en.yml index be173d985..3cc1a947a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -195,7 +195,7 @@ en: owner_plantings: "%{owner} plantings" string: "%{crop} planting in %{garden} by %{owner}" badges: - zombie: zombie + super late: super late sharedbuttonsfinish_planting: shared/buttons/finish_planting days_until_finished: days until finished harvesting_now: harvesting now diff --git a/spec/features/gardens/gardens_index_spec.rb b/spec/features/gardens/gardens_index_spec.rb index 516796641..0a973e305 100644 --- a/spec/features/gardens/gardens_index_spec.rb +++ b/spec/features/gardens/gardens_index_spec.rb @@ -120,13 +120,13 @@ feature "Gardens#index", :js do it { expect(page).not_to have_text 'days until harvest' } end - describe 'zombie' do + describe 'super late' do let!(:planting) do FactoryBot.create :planting, crop: crop, owner: member, garden: garden, planted_at: 260.days.ago end - it { expect(page).to have_text 'zombie' } + it { expect(page).to have_text 'super late' } it { expect(page).not_to have_text 'harvesting now' } it { expect(page).not_to have_text 'days until harvest' } it { expect(page).not_to have_text 'days until finished' }