From 8a1e4719c73fb2938ede6ed344da9a0103404e9c Mon Sep 17 00:00:00 2001 From: Wimsy113 Date: Mon, 21 Mar 2016 11:26:51 -0400 Subject: [PATCH 01/10] Revert "Worked at has been added to check ins table"s This reverts commit 232b9e6222e42e88b6230d5ff7722190fafd6b10. --- Gemfile.lock | 82 ++++++++++++++++++++++++++-------------------------- bin/bundle | 4 +-- bin/rails | 10 ++----- bin/rake | 8 ++--- bin/setup | 4 +-- 5 files changed, 50 insertions(+), 58 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3bc8233..e8b2a44 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,36 +1,36 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.5.1) - actionpack (= 4.2.5.1) - actionview (= 4.2.5.1) - activejob (= 4.2.5.1) + actionmailer (4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.5.1) - actionview (= 4.2.5.1) - activesupport (= 4.2.5.1) + actionpack (4.2.6) + actionview (= 4.2.6) + activesupport (= 4.2.6) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.5.1) - activesupport (= 4.2.5.1) + actionview (4.2.6) + activesupport (= 4.2.6) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.5.1) - activesupport (= 4.2.5.1) + activejob (4.2.6) + activesupport (= 4.2.6) globalid (>= 0.3.0) - activemodel (4.2.5.1) - activesupport (= 4.2.5.1) + activemodel (4.2.6) + activesupport (= 4.2.6) builder (~> 3.1) - activerecord (4.2.5.1) - activemodel (= 4.2.5.1) - activesupport (= 4.2.5.1) + activerecord (4.2.6) + activemodel (= 4.2.6) + activesupport (= 4.2.6) arel (~> 6.0) - activesupport (4.2.5.1) + activesupport (4.2.6) i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) @@ -43,7 +43,7 @@ GEM descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) - bcrypt (3.1.10) + bcrypt (3.1.11) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) bitters (1.2.0) @@ -66,13 +66,13 @@ GEM capybara-screenshot (1.0.11) capybara (>= 1.0, < 3) launchy - codeclimate-test-reporter (0.4.8) + codeclimate-test-reporter (0.5.0) simplecov (>= 0.7.1, < 1.0.0) - coderay (1.1.0) + coderay (1.1.1) coercible (1.0.0) descendants_tracker (~> 0.0.1) columnize (0.9.0) - concurrent-ruby (1.0.0) + concurrent-ruby (1.0.1) debug_inspector (0.0.2) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) @@ -110,8 +110,8 @@ GEM tilt i18n (0.7.0) ice_nine (0.11.2) - jquery-rails (4.1.0) - rails-dom-testing (~> 1.0) + jquery-rails (4.1.1) + rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (5.0.5) @@ -124,10 +124,10 @@ GEM mail (2.6.3) mime-types (>= 1.16, < 3) method_source (0.8.2) - mime-types (2.99) + mime-types (2.99.1) mini_portile2 (2.0.0) minitest (5.8.4) - neat (1.7.2) + neat (1.7.4) bourbon (>= 4.0) sass (>= 3.3) nokogiri (1.6.7.2) @@ -150,16 +150,16 @@ GEM rack-test (0.6.3) rack (>= 1.0) rack-timeout (0.3.2) - rails (4.2.5.1) - actionmailer (= 4.2.5.1) - actionpack (= 4.2.5.1) - actionview (= 4.2.5.1) - activejob (= 4.2.5.1) - activemodel (= 4.2.5.1) - activerecord (= 4.2.5.1) - activesupport (= 4.2.5.1) + rails (4.2.6) + actionmailer (= 4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) + activemodel (= 4.2.6) + activerecord (= 4.2.6) + activesupport (= 4.2.6) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.5.1) + railties (= 4.2.6) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -174,17 +174,17 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.4) - railties (4.2.5.1) - actionpack (= 4.2.5.1) - activesupport (= 4.2.5.1) + railties (4.2.6) + actionpack (= 4.2.6) + activesupport (= 4.2.6) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.1.0) - rake (10.5.0) + rake (11.1.1) rdoc (4.2.2) json (~> 1.4) request_store (1.3.0) - responders (2.1.1) + responders (2.1.2) railties (>= 4.2.0, < 5.1) rspec (3.4.0) rspec-core (~> 3.4.0) @@ -237,11 +237,11 @@ GEM simplecov-html (0.10.0) slop (3.6.0) sorcerer (1.0.2) - spring (1.6.3) + spring (1.6.4) sprockets (3.5.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.0.1) + sprockets-rails (3.0.4) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) diff --git a/bin/bundle b/bin/bundle index fe18745..66e9889 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) -load Gem.bin_path("bundler", "bundle") +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index ed2b968..5191e69 100755 --- a/bin/rails +++ b/bin/rails @@ -1,8 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path("../spring", __FILE__) -rescue LoadError -end -APP_PATH = File.expand_path("../../config/application", __FILE__) -require_relative "../config/boot" -require "rails/commands" +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake index 67afb85..1724048 100755 --- a/bin/rake +++ b/bin/rake @@ -1,8 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path("../spring", __FILE__) -rescue LoadError -end -require_relative "../config/boot" -require "rake" +require_relative '../config/boot' +require 'rake' Rake.application.run diff --git a/bin/setup b/bin/setup index 242ef0c..acdb2c1 100755 --- a/bin/setup +++ b/bin/setup @@ -1,8 +1,8 @@ #!/usr/bin/env ruby -require "pathname" +require 'pathname' # path to your application root. -APP_ROOT = Pathname.new File.expand_path("../../", __FILE__) +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) Dir.chdir APP_ROOT do # This script is a starting point to setup your application. From 5dacfa76ef30b7d1f3cf3fc8869083f209c40ab3 Mon Sep 17 00:00:00 2001 From: Wimsy113 Date: Mon, 21 Mar 2016 11:43:48 -0400 Subject: [PATCH 02/10] upgraded ruby version --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 9e55302..0b89612 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -ruby "2.2.4" +ruby "2.3.0" gem "rails", "~> 4.2" From 938f2b2b94a0039042e90193e1fe89d25bbe254f Mon Sep 17 00:00:00 2001 From: Wimsy113 Date: Mon, 21 Mar 2016 12:03:49 -0400 Subject: [PATCH 03/10] updated .ruby-version file to use 2.3.0 --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 530cdd9..276cbf9 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.2.4 +2.3.0 From 00b9706e806c64fad12b418bbf56f3e5925c2254 Mon Sep 17 00:00:00 2001 From: Wimsy113 Date: Mon, 21 Mar 2016 13:11:07 -0400 Subject: [PATCH 04/10] changed log capacity to track activity --- app/views/logs/_form.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/logs/_form.erb b/app/views/logs/_form.erb index 12c5468..19a6ea0 100644 --- a/app/views/logs/_form.erb +++ b/app/views/logs/_form.erb @@ -23,6 +23,6 @@ <%= f.text_area :notes %> <%= render partial: "error_for_field", locals: { model: @log, field: :notes } %> - <%= f.submit "Log Capacity" %> + <%= f.submit "Track Activity" %> <%= link_to "Return To Dashboard", root_path %> <%- end %> From c0b9218313de4dacb945e8a833fabce75e4e7649 Mon Sep 17 00:00:00 2001 From: Wimsy113 Date: Wed, 23 Mar 2016 09:43:24 -0400 Subject: [PATCH 05/10] Revert "changed log capacity to track activity" This reverts commit 00b9706e806c64fad12b418bbf56f3e5925c2254. --- app/views/logs/_form.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/logs/_form.erb b/app/views/logs/_form.erb index 19a6ea0..12c5468 100644 --- a/app/views/logs/_form.erb +++ b/app/views/logs/_form.erb @@ -23,6 +23,6 @@ <%= f.text_area :notes %> <%= render partial: "error_for_field", locals: { model: @log, field: :notes } %> - <%= f.submit "Track Activity" %> + <%= f.submit "Log Capacity" %> <%= link_to "Return To Dashboard", root_path %> <%- end %> From 75179ae9e697889311c2919d07f0e212806ca0ec Mon Sep 17 00:00:00 2001 From: Wimsy113 Date: Wed, 23 Mar 2016 09:52:06 -0400 Subject: [PATCH 06/10] added track activity and changed default display for check ins to true --- app/models/features.rb | 2 +- app/views/logs/_form.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/features.rb b/app/models/features.rb index 84a80b5..4d71c81 100644 --- a/app/models/features.rb +++ b/app/models/features.rb @@ -1,7 +1,7 @@ # Co-erces an HStore object of feature flags into a ruby model class Features include Virtus.model - attribute :check_in, Boolean, default: false + attribute :check_in, Boolean, default: true def self.dump(features) features.to_hash diff --git a/app/views/logs/_form.erb b/app/views/logs/_form.erb index 12c5468..19a6ea0 100644 --- a/app/views/logs/_form.erb +++ b/app/views/logs/_form.erb @@ -23,6 +23,6 @@ <%= f.text_area :notes %> <%= render partial: "error_for_field", locals: { model: @log, field: :notes } %> - <%= f.submit "Log Capacity" %> + <%= f.submit "Track Activity" %> <%= link_to "Return To Dashboard", root_path %> <%- end %> From 6344636f66d049ac90d940f9d913b3c02958d019 Mon Sep 17 00:00:00 2001 From: Wimsy113 Date: Wed, 23 Mar 2016 09:58:34 -0400 Subject: [PATCH 07/10] changed log capacity in spec to track activity --- spec/features/logging_time_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/features/logging_time_spec.rb b/spec/features/logging_time_spec.rb index 3fe808c..3619381 100644 --- a/spec/features/logging_time_spec.rb +++ b/spec/features/logging_time_spec.rb @@ -15,14 +15,14 @@ When { fill_in("Worked at", with: worked_at) } context "when tracking time as billable" do - When { click_link_or_button("Log Capacity") } + When { click_link_or_button("Track Activity") } Then { expect(log.do_not_bill).to be(false) } Then { expect(log).to be_persisted } end context "when tracking time as do not bill" do When { check("Do Not Bill") } - When { click_link_or_button("Log Capacity") } + When { click_link_or_button("Track Activity") } Then { expect(log.do_not_bill).to be(true) } Then { expect(log).to be_persisted } end @@ -37,6 +37,6 @@ When { within("##{decorated_log.dom_id}") { click_link_or_button("Edit") } } When { select("😄", from: "How'd it go?") } - When { click_link_or_button("Log Capacity") } + When { click_link_or_button("Track Activity") } Then { expect(log.reload.quality).to eql(5) } end From 6b8e12ef7c73e1e6edb77c7865d5888b55571d5f Mon Sep 17 00:00:00 2001 From: Wimsy113 Date: Wed, 23 Mar 2016 12:03:39 -0400 Subject: [PATCH 08/10] switched default back to false --- app/models/features.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/features.rb b/app/models/features.rb index 4d71c81..84a80b5 100644 --- a/app/models/features.rb +++ b/app/models/features.rb @@ -1,7 +1,7 @@ # Co-erces an HStore object of feature flags into a ruby model class Features include Virtus.model - attribute :check_in, Boolean, default: true + attribute :check_in, Boolean, default: false def self.dump(features) features.to_hash From ea4658c3f77b969efb493d439b65846a42251aed Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 23 Mar 2016 18:01:17 +0000 Subject: [PATCH 09/10] Hide archived activities on check in page --- app/models/check_in.rb | 2 +- spec/factories/activities.rb | 5 ++++ spec/features/checking_in_spec.rb | 39 ++++++++++++++++++++----------- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/app/models/check_in.rb b/app/models/check_in.rb index 7fafe67..36c1d3b 100644 --- a/app/models/check_in.rb +++ b/app/models/check_in.rb @@ -10,7 +10,7 @@ def log_entries_attributes=(log_entries_attributes) end def log_entries - Activity.all.map do |activity| + Activity.active.map do |activity| logs.new(activity: activity) end end diff --git a/spec/factories/activities.rb b/spec/factories/activities.rb index 79590c7..6af1d73 100644 --- a/spec/factories/activities.rb +++ b/spec/factories/activities.rb @@ -7,5 +7,10 @@ weekly_burn_rate 4 billable true owner + + factory :archived_activity do + sequence(:name) { |i| "Archived Activity #{i}" } + active false + end end end diff --git a/spec/features/checking_in_spec.rb b/spec/features/checking_in_spec.rb index 27930cb..af40dc1 100644 --- a/spec/features/checking_in_spec.rb +++ b/spec/features/checking_in_spec.rb @@ -30,23 +30,34 @@ def fill_in_notes(activity, content) Given!(:work_activity) { FactoryGirl.create(:activity, name: "Do Work") } When { click_link_or_button "Check In" } - When { fill_in("What day is this for?", with: worked_at) } - When { select_quantity(fun_activity, "1~2 hours") } - When { fill_in_notes(fun_activity, "SO MUCH FUN") } - When { select_quality(fun_activity, "Great! It was Like I was super powered!") } + describe "Logging a bunch of activities" do + When { fill_in("What day is this for?", with: worked_at) } - When { select_quantity(work_activity, "4~6 hours") } - When { fill_in_notes(work_activity, "DID SO MUCH") } - When { select_quality(work_activity, "Good! I was REALLY focused") } + When { select_quantity(fun_activity, "1~2 hours") } + When { fill_in_notes(fun_activity, "SO MUCH FUN") } + When { select_quality(fun_activity, "Great! It was Like I was super powered!") } - When { click_link_or_button("Create Check in") } + When { select_quantity(work_activity, "4~6 hours") } + When { fill_in_notes(work_activity, "DID SO MUCH") } + When { select_quality(work_activity, "Good! I was REALLY focused") } - Then { work_log_entry.notes == "DID SO MUCH" } - Then { work_log_entry.quality == 3 } - Then { work_log_entry.amount == 6 } + When { click_link_or_button("Create Check in") } - Then { fun_log_entry.notes == "SO MUCH FUN" } - Then { fun_log_entry.quality == 4 } - Then { fun_log_entry.amount == 2 } + Then { work_log_entry.notes == "DID SO MUCH" } + Then { work_log_entry.quality == 3 } + Then { work_log_entry.amount == 6 } + + Then { fun_log_entry.notes == "SO MUCH FUN" } + Then { fun_log_entry.quality == 4 } + Then { fun_log_entry.amount == 2 } + end + + describe "Archived activities" do + Given!(:archived_activity) { FactoryGirl.create(:archived_activity) } + + Then { expect(page).not_to have_content(archived_activity.name) } + Then { expect(activity_div(fun_activity)).to be_present } + Then { expect(activity_div(work_activity)).to be_present } + end end From e74ae39b73b03f491f49f5ca09b9b799267d7ca9 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 23 Mar 2016 18:26:47 +0000 Subject: [PATCH 10/10] Track CheckIn creation in analytics --- app/controllers/check_ins_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/check_ins_controller.rb b/app/controllers/check_ins_controller.rb index d45d130..95f238f 100644 --- a/app/controllers/check_ins_controller.rb +++ b/app/controllers/check_ins_controller.rb @@ -8,6 +8,7 @@ def create @check_in = CheckIn.new(check_in_params) if @check_in.save flash[:notice] = "check in created!" + track_check_in_creation(@check_in) redirect_to root_path else render :new @@ -46,4 +47,9 @@ def create :notes, :activity_id]] end + + private def track_check_in_creation(check_in) + track_event("Check in created", log_count: check_in.logs.count, + worked_at: check_in.logs.first.worked_at) + end end