From 290b1944d6091ec3aa0f478e6f0fd9137b96778b Mon Sep 17 00:00:00 2001 From: Em Klick Date: Tue, 11 Jul 2017 14:29:28 +0000 Subject: [PATCH 1/9] 2134 --- app/controllers/calculations_controller.rb | 61 ++++++++++++++-------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index 0df2d0f..0794b66 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -11,13 +11,20 @@ def word_count # ================================================================================ - @word_count = "Replace this string with your answer." - @character_count_with_spaces = "Replace this string with your answer." + @word_count = @text.split(" ").length - @character_count_without_spaces = "Replace this string with your answer." + @character_count_with_spaces = @text.length - @occurrences = "Replace this string with your answer." + @character_count_without_spaces = @text.length-@text.count(" ") + + punctuation = @text.chomp(".") + + downcased_words = punctuation.downcase.split(" ") + + downcased_special = @special_word.downcase + + @occurrences = downcased_words.count(downcased_special) # ================================================================================ # Your code goes above. @@ -38,7 +45,10 @@ def loan_payment # The principal value the user input is in the decimal @principal. # ================================================================================ - @monthly_payment = "Replace this string with your answer." + monthly_interest = (@apr/12)/100 + number_of_monthly_payments = @years*-12 + + @monthly_payment = @principal*(monthly_interest/(1-(1+monthly_interest)**number_of_monthly_payments)) # ================================================================================ # Your code goes above. @@ -60,12 +70,12 @@ def time_between # number of seconds as a result. # ================================================================================ - @seconds = "Replace this string with your answer." - @minutes = "Replace this string with your answer." - @hours = "Replace this string with your answer." - @days = "Replace this string with your answer." - @weeks = "Replace this string with your answer." - @years = "Replace this string with your answer." + @seconds = @ending-@starting + @minutes = @seconds/60 + @hours = @minutes/60 + @days = @hours/24 + @weeks = @days/7 + @years = @weeks/52 # ================================================================================ # Your code goes above. @@ -76,33 +86,40 @@ def time_between def descriptive_statistics @numbers = params[:list_of_numbers].gsub(',', '').split.map(&:to_f) + + # ================================================================================ # Your code goes below. # The numbers the user input are in the array @numbers. # ================================================================================ - @sorted_numbers = "Replace this string with your answer." + @sorted_numbers = @numbers.sort + + @count = @numbers.count - @count = "Replace this string with your answer." + @minimum = @numbers.min - @minimum = "Replace this string with your answer." + @maximum = @numbers.max - @maximum = "Replace this string with your answer." + @range = @maximum-@minimum - @range = "Replace this string with your answer." + @median = @sorted_numbers[((@count/2)+(1/2))] - @median = "Replace this string with your answer." + @sum = @numbers.sum - @sum = "Replace this string with your answer." + @mean = @sum/@count - @mean = "Replace this string with your answer." + @demeaned=@numbers.map { |i| i - @mean} + @squared = @demeaned.map { |i| i**2} + @variance = @squared.sum / @count - @variance = "Replace this string with your answer." + @variance = @squared.sum / @count - @standard_deviation = "Replace this string with your answer." + @standard_deviation = Math.sqrt(@variance) - @mode = "Replace this string with your answer." + @mode_count = @numbers.map { |i| @numbers.count(i)} + @mode = @numbers[@mode_count.index(@mode_count.sort[@mode_count.count - 1])] # ================================================================================ # Your code goes above. From b47c2ebac88cc8c4eb2a206aa614a46bb7606aee Mon Sep 17 00:00:00 2001 From: Em Klick Date: Tue, 11 Jul 2017 14:44:49 +0000 Subject: [PATCH 2/9] 2543 --- Gemfile | 4 ++++ Gemfile.lock | 16 ++++++++++++---- app/assets/javascripts/application.js | 16 ---------------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Gemfile b/Gemfile index b625ba3..ad81c81 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,9 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end +gem 'momentjs-rails' +gem 'bootstrap3-datetimepicker-rails' +gem 'chronic' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.2' @@ -73,3 +76,4 @@ end gem 'bootstrap', '~> 4.0.0.alpha6' gem 'jquery-rails' gem 'font-awesome-sass', '~> 4.7.0' + diff --git a/Gemfile.lock b/Gemfile.lock index a4b753b..57ad791 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/firstdraft/grade_runner.git - revision: 881cce30367bc9a5f15a3e4ac4cb48599dbecec2 + revision: 83db5d2b90086055aa3204afe38a18394aecea16 specs: grade_runner (0.0.1) @@ -62,7 +62,7 @@ GEM activerecord (>= 3.2, < 6.0) rake (>= 10.4, < 13.0) arel (8.0.0) - autoprefixer-rails (7.1.1.3) + autoprefixer-rails (7.1.2.1) execjs awesome_print (1.8.0) better_errors (2.1.1) @@ -75,6 +75,8 @@ GEM bootstrap (4.0.0.alpha6) autoprefixer-rails (>= 6.0.3) sass (>= 3.4.19) + bootstrap3-datetimepicker-rails (4.17.47) + momentjs-rails (>= 2.8.1) builder (3.2.3) byebug (9.0.6) callsite (0.0.11) @@ -85,6 +87,7 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) + chronic (0.10.2) coderay (1.1.1) concurrent-ruby (1.0.5) crack (0.4.3) @@ -110,7 +113,7 @@ GEM globalid (0.4.0) activesupport (>= 4.2.0) hashdiff (0.3.4) - i18n (0.8.4) + i18n (0.8.6) jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) @@ -140,6 +143,8 @@ GEM mime-types-data (3.2016.0521) mini_portile2 (2.2.0) minitest (5.10.2) + momentjs-rails (2.17.1) + railties (>= 3.1) multi_json (1.12.1) nio4r (2.1.0) nokogiri (1.8.0) @@ -208,7 +213,7 @@ GEM rspec-support (3.6.0) ruby_dep (1.5.0) safe_yaml (1.0.4) - sass (3.4.24) + sass (3.4.25) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) @@ -262,8 +267,10 @@ DEPENDENCIES better_errors binding_of_caller bootstrap (~> 4.0.0.alpha6) + bootstrap3-datetimepicker-rails byebug capybara + chronic dotenv-rails factory_girl_rails firstdraft_generators @@ -274,6 +281,7 @@ DEPENDENCIES letter_opener listen (>= 3.0.5, < 3.2) meta_request + momentjs-rails pry-rails puma (~> 3.7) rails (~> 5.1.2) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 739c2fe..e69de29 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,16 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's -// vendor/assets/javascripts directory can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. JavaScript code in this file should be added after the last require_* statement. -// -// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details -// about supported directives. -// -//= require rails-ujs -//= require bootstrap -//= require turbolinks -//= require_tree . From 402d30da300df5c1aac6309a698efc3a3e2ab89b Mon Sep 17 00:00:00 2001 From: Em Klick Date: Tue, 11 Jul 2017 23:52:33 +0000 Subject: [PATCH 3/9] 345678 --- Gemfile | 7 +++---- Gemfile.lock | 2 +- app/assets/javascripts/application.js | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index ad81c81..8df277b 100644 --- a/Gemfile +++ b/Gemfile @@ -5,10 +5,6 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end -gem 'momentjs-rails' -gem 'bootstrap3-datetimepicker-rails' -gem 'chronic' - # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.2' # Use sqlite3 as the database for Active Record @@ -77,3 +73,6 @@ gem 'bootstrap', '~> 4.0.0.alpha6' gem 'jquery-rails' gem 'font-awesome-sass', '~> 4.7.0' +gem 'momentjs-rails' +gem 'bootstrap3-datetimepicker-rails' +gem 'chronic' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 57ad791..d711574 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -62,7 +62,7 @@ GEM activerecord (>= 3.2, < 6.0) rake (>= 10.4, < 13.0) arel (8.0.0) - autoprefixer-rails (7.1.2.1) + autoprefixer-rails (7.1.2.2) execjs awesome_print (1.8.0) better_errors (2.1.1) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e69de29..aa65ad0 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -0,0 +1,26 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's +// vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. JavaScript code in this file should be added after the last require_* statement. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require rails-ujs +//= require jquery +//= require bootstrap +//= require turbolinks +//= require_tree . + + +/= require moment +//= require bootstrap-datetimepicker + +$(function () { + $('.datetimepicker').datetimepicker(); +}); + From 0b10f91bd33b6d398666fb74ef2564444f8895b7 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Wed, 12 Jul 2017 00:09:58 +0000 Subject: [PATCH 4/9] tyh --- app/assets/javascripts/application.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index aa65ad0..4277e98 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -15,8 +15,6 @@ //= require bootstrap //= require turbolinks //= require_tree . - - /= require moment //= require bootstrap-datetimepicker From 0ff40b397a6cd14c15279fda0f3818f2d8f247fb Mon Sep 17 00:00:00 2001 From: Em Klick Date: Wed, 12 Jul 2017 22:59:22 +0000 Subject: [PATCH 5/9] wert --- app/assets/javascripts/application.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 4277e98..993f9e2 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -10,13 +10,14 @@ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // -//= require rails-ujs -//= require jquery -//= require bootstrap -//= require turbolinks -//= require_tree . -/= require moment -//= require bootstrap-datetimepicker + +require rails-ujs; +require jquery; +require bootstrap; +require turbolinks; +require_tree; +require moment; +require bootstrap-datetimepicker; $(function () { $('.datetimepicker').datetimepicker(); From be1f5eca78e64cc0cbe6d5d8cf8a16648aadbb80 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Thu, 13 Jul 2017 00:16:21 +0000 Subject: [PATCH 6/9] 123456 --- Gemfile | 5 ++++- app/assets/javascripts/application.js | 16 ++++++++-------- app/controllers/calculations_controller.rb | 12 +++++++----- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 8df277b..4f99b7a 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end + # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.2' # Use sqlite3 as the database for Active Record @@ -73,6 +74,8 @@ gem 'bootstrap', '~> 4.0.0.alpha6' gem 'jquery-rails' gem 'font-awesome-sass', '~> 4.7.0' + gem 'momentjs-rails' gem 'bootstrap3-datetimepicker-rails' -gem 'chronic' \ No newline at end of file +gem 'chronic' + diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 993f9e2..3d5e053 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -10,16 +10,16 @@ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // +//= require rails-ujs +//= require jquery +//= require bootstrap +//= require turbolinks +//= require_tree . -require rails-ujs; -require jquery; -require bootstrap; -require turbolinks; -require_tree; -require moment; -require bootstrap-datetimepicker; + +//= require moment +//= require bootstrap-datetimepicker $(function () { $('.datetimepicker').datetimepicker(); }); - diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index 0794b66..8c830ff 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -110,13 +110,15 @@ def descriptive_statistics @mean = @sum/@count - @demeaned=@numbers.map { |i| i - @mean} - @squared = @demeaned.map { |i| i**2} - @variance = @squared.sum / @count - @variance = @squared.sum / @count - @standard_deviation = Math.sqrt(@variance) +@demeaned=@numbers.map { |i| i - @mean} +@squared = @demeanded.map { |i| i**2} +@variance = @squared.sum / @count + + @variance = @numbers.variance + + @standard_deviation = math.sqrt(@variance) @mode_count = @numbers.map { |i| @numbers.count(i)} @mode = @numbers[@mode_count.index(@mode_count.sort[@mode_count.count - 1])] From da7cf7e1703de57dab0566031907d6eb1306be45 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Thu, 13 Jul 2017 01:01:50 +0000 Subject: [PATCH 7/9] 1234567823456 --- Gemfile.lock | 6 +++++- app/controllers/calculations_controller.rb | 12 +++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d711574..57433fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -213,7 +213,11 @@ GEM rspec-support (3.6.0) ruby_dep (1.5.0) safe_yaml (1.0.4) - sass (3.4.25) + sass (3.5.0) + sass-listen (~> 3.0.7) + sass-listen (3.0.7) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9.7) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index 8c830ff..0794b66 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -110,15 +110,13 @@ def descriptive_statistics @mean = @sum/@count + @demeaned=@numbers.map { |i| i - @mean} + @squared = @demeaned.map { |i| i**2} + @variance = @squared.sum / @count + @variance = @squared.sum / @count -@demeaned=@numbers.map { |i| i - @mean} -@squared = @demeanded.map { |i| i**2} -@variance = @squared.sum / @count - - @variance = @numbers.variance - - @standard_deviation = math.sqrt(@variance) + @standard_deviation = Math.sqrt(@variance) @mode_count = @numbers.map { |i| @numbers.count(i)} @mode = @numbers[@mode_count.index(@mode_count.sort[@mode_count.count - 1])] From 824dd3ce623ef661763e579cb7c5b903488fdbf9 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Thu, 13 Jul 2017 01:12:52 +0000 Subject: [PATCH 8/9] 12345678909876543 --- Gemfile | 1 - app/assets/javascripts/application.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 4f99b7a..34528d9 100644 --- a/Gemfile +++ b/Gemfile @@ -78,4 +78,3 @@ gem 'font-awesome-sass', '~> 4.7.0' gem 'momentjs-rails' gem 'bootstrap3-datetimepicker-rails' gem 'chronic' - diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 3d5e053..2791911 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -22,4 +22,4 @@ $(function () { $('.datetimepicker').datetimepicker(); -}); +}); \ No newline at end of file From a645f28df510b6c6a6505264d697385d3fd11786 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Thu, 13 Jul 2017 02:02:59 +0000 Subject: [PATCH 9/9] 456 --- circle.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/circle.yml b/circle.yml index c32e24c..b895dc3 100644 --- a/circle.yml +++ b/circle.yml @@ -4,9 +4,7 @@ machine: ruby: version: 2.3.1 -database: - override: - - bin/setup + test: override: - COVERAGE=true bin/rails grade_runner:runner