From e569bfbb5082f87a6e699f16500a217de8ee7d6f Mon Sep 17 00:00:00 2001 From: Em Klick Date: Thu, 6 Jul 2017 01:06:21 +0000 Subject: [PATCH 01/12] omnicalc-ruby --- app/controllers/calculations_controller.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index 0df2d0f..05674a1 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -11,13 +11,14 @@ 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(" ") + + @occurrences = @text.split(" ").count(@special_word.capitalize)+@text.split(" ").count(@special_word) # ================================================================================ # Your code goes above. From 92b16ce471aa30c0fcd6a4bec2c3d69c2da1b787 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Sat, 8 Jul 2017 20:47:07 +0000 Subject: [PATCH 02/12] monthly payment --- Gemfile.lock | 8 ++++---- app/controllers/calculations_controller.rb | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a4b753b..ca780db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/firstdraft/grade_runner.git - revision: 881cce30367bc9a5f15a3e4ac4cb48599dbecec2 + revision: dabf435a51bb4742f4c5b863d9f232c34f85ba87 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) @@ -110,7 +110,7 @@ GEM globalid (0.4.0) activesupport (>= 4.2.0) hashdiff (0.3.4) - i18n (0.8.4) + i18n (0.8.5) jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) @@ -208,7 +208,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) diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index 05674a1..a2a3f0d 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -18,7 +18,10 @@ def word_count @character_count_without_spaces = @text.length-@text.count(" ") - @occurrences = @text.split(" ").count(@special_word.capitalize)+@text.split(" ").count(@special_word) + downcased_words = @text.downcase.split(" ") + downcased_special = @special_word.downcase + + @occurrences = downcased_words.count(downcased_special) # ================================================================================ # Your code goes above. @@ -39,7 +42,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. From a8ea3b65c61b2793098888fc3ed368df0b91d8fb Mon Sep 17 00:00:00 2001 From: Em Klick Date: Sat, 8 Jul 2017 21:20:36 +0000 Subject: [PATCH 03/12] 1 --- app/controllers/calculations_controller.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index a2a3f0d..2b73373 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -18,7 +18,10 @@ def word_count @character_count_without_spaces = @text.length-@text.count(" ") - downcased_words = @text.downcase.split(" ") + punctuation = @text.chomp(".") + + downcased_words = punctuationss.downcase.split(" ") + downcased_special = @special_word.downcase @occurrences = downcased_words.count(downcased_special) @@ -42,10 +45,10 @@ def loan_payment # The principal value the user input is in the decimal @principal. # ================================================================================ - monthly_interest = ((@apr/12)/100) + monthly_interest = (@apr/12)/100 number_of_monthly_payments = @years*-12 - @monthly_payment = @principal*((monthly_interest)/(1-(1+monthly_interest)**(number_of_monthly_payments))) + @monthly_payment = @principal*(monthly_interest/(1-(1+monthly_interest)**number_of_monthly_payments)) # ================================================================================ # Your code goes above. @@ -67,7 +70,7 @@ def time_between # number of seconds as a result. # ================================================================================ - @seconds = "Replace this string with your answer." + @seconds = (@ending-@starting)*24*60*60 @minutes = "Replace this string with your answer." @hours = "Replace this string with your answer." @days = "Replace this string with your answer." From ef854513483860e4c0ea333139aeb6176fd4c20d Mon Sep 17 00:00:00 2001 From: Em Klick Date: Sat, 8 Jul 2017 21:43:42 +0000 Subject: [PATCH 04/12] qwe --- Gemfile | 4 +++- Gemfile.lock | 8 ++++++++ app/assets/javascripts/application.js | 9 +++++++++ app/controllers/calculations_controller.rb | 20 ++++++++++---------- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index b625ba3..20796d1 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,9 @@ git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "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' diff --git a/Gemfile.lock b/Gemfile.lock index ca780db..0ba3ccd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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..ff5cbac 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -14,3 +14,12 @@ //= require bootstrap //= require turbolinks //= require_tree . + + +//= require jquery +//= require moment +//= require bootstrap-datetimepicker + +$(function () { + $('.datetimepicker').datetimepicker(); +}); \ No newline at end of file diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index 2b73373..b7250bf 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -20,7 +20,7 @@ def word_count punctuation = @text.chomp(".") - downcased_words = punctuationss.downcase.split(" ") + downcased_words = punctuation.downcase.split(" ") downcased_special = @special_word.downcase @@ -70,12 +70,12 @@ def time_between # number of seconds as a result. # ================================================================================ - @seconds = (@ending-@starting)*24*60*60 - @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. @@ -94,11 +94,11 @@ def descriptive_statistics @sorted_numbers = "Replace this string with your answer." - @count = "Replace this string with your answer." + @count = @numbers.count(" ") - @minimum = "Replace this string with your answer." + @minimum = @numbers.min - @maximum = "Replace this string with your answer." + @maximum = @numbers.max @range = "Replace this string with your answer." From 47576061eec8deaf034022598bcbb6a52253d0cf Mon Sep 17 00:00:00 2001 From: Em Klick Date: Sat, 8 Jul 2017 23:46:14 +0000 Subject: [PATCH 05/12] stats --- Gemfile | 20 +++++ Gemfile.lock | 86 ++++++++++++++++++++++ app/controllers/calculations_controller.rb | 20 ++--- 3 files changed, 117 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 20796d1..aedab42 100644 --- a/Gemfile +++ b/Gemfile @@ -75,3 +75,23 @@ end gem 'bootstrap', '~> 4.0.0.alpha6' gem 'jquery-rails' gem 'font-awesome-sass', '~> 4.7.0' + +gem 'descriptive-statistics' + +gem 'variance', '~> 0.2.0' + +gem 'standard_deviation', '~> 1.0', '>= 1.0.3' + +gem 'mode', '~> 0.0.26' + + +gem 'mean_median_mode', '~> 0.3.0' + +gem 'descriptive_statistics', '~> 2.5', '>= 2.5.1' + +gem 'quickstats', '~> 2.0' + +gem 'statsample', '~> 2.0', '>= 2.0.2' + +gem 'statistica', '~> 0.1.0' + diff --git a/Gemfile.lock b/Gemfile.lock index 0ba3ccd..1991775 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -65,6 +65,7 @@ GEM autoprefixer-rails (7.1.2.1) execjs awesome_print (1.8.0) + backports (3.8.0) better_errors (2.1.1) coderay (>= 1.0.0) erubis (>= 2.6.6) @@ -88,12 +89,19 @@ GEM rack-test (>= 0.5.4) xpath (~> 2.0) chronic (0.10.2) + clbustos-rtf (0.4.2) coderay (1.1.1) concurrent-ruby (1.0.5) crack (0.4.3) safe_yaml (~> 1.0.0) + daru (0.1.5) + backports debug_inspector (0.0.3) + descriptive-statistics (2.2.0) + descriptive_statistics (2.5.1) diff-lcs (1.3) + dirty-memoize (0.0.4) + distribution (0.7.3) dotenv (2.2.1) dotenv-rails (2.2.1) dotenv (= 2.2.1) @@ -101,11 +109,16 @@ GEM erubi (1.6.1) erubis (2.7.0) execjs (2.7.0) + extendmatrix (0.4) factory_girl (4.8.0) activesupport (>= 3.0.0) factory_girl_rails (4.8.0) factory_girl (~> 4.8.0) railties (>= 3.0.0) + faraday (0.9.0) + multipart-post (>= 1.2, < 3) + faraday_middleware (0.9.1) + faraday (>= 0.7.4, < 0.10) ffi (1.9.18) firstdraft_generators (0.0.3) font-awesome-sass (4.7.0) @@ -117,6 +130,10 @@ GEM jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) + jdbc-hive2 (0.11.0.1) + jdbc-jtds (1.3.1) + jdbc-mysql (5.1.28) + jdbc-postgres (9.3.1101) jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -133,6 +150,7 @@ GEM nokogiri (>= 1.5.9) mail (2.6.6) mime-types (>= 1.16, < 4) + mean_median_mode (0.3.0) meta_request (0.4.3) callsite (~> 0.0, >= 0.0.11) rack-contrib (>= 1.1, < 3) @@ -142,10 +160,27 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_portile2 (2.2.0) + minimization (0.2.3) + text-table (~> 1.2) minitest (5.10.2) + mode (0.0.26) + faraday (= 0.9.0) + faraday_middleware (= 0.9.1) + jdbc-hive2 + jdbc-jtds (= 1.3.1) + jdbc-mysql (= 5.1.28) + jdbc-postgres (= 9.3.1101) + multipart-post (= 1.2.0) + rufus-scheduler (= 3.0.7) + sequel (= 4.9.0) + sequel-jdbc-hive2-adapter + spoon (= 0.0.4) + thor (~> 0.19.1) + uri_template (= 0.7.0) momentjs-rails (2.17.1) railties (>= 3.1) multi_json (1.12.1) + multipart-post (1.2.0) nio4r (2.1.0) nokogiri (1.8.0) mini_portile2 (~> 2.2.0) @@ -154,6 +189,15 @@ GEM octicons_helper (3.0.1) octicons (~> 3.0) rails + prawn (0.8.4) + prawn-core (>= 0.8.4, < 0.9) + prawn-layout (>= 0.8.4, < 0.9) + prawn-security (>= 0.8.4, < 0.9) + prawn-core (0.8.4) + prawn-layout (0.8.4) + prawn-security (0.8.4) + prawn-svg (0.9.1.11) + prawn (>= 0.8.4) pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) @@ -162,6 +206,7 @@ GEM pry (>= 0.10.4) public_suffix (2.0.5) puma (3.9.1) + quickstats (2.0.0) rack (2.0.3) rack-contrib (1.2.0) rack (>= 0.9.1) @@ -194,6 +239,12 @@ GEM rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) + reportbuilder (1.4.2) + clbustos-rtf (~> 0.4.0) + prawn (~> 0.8.4) + prawn-svg (~> 0.9.1) + text-table (~> 1.2) + rserve-client (0.3.3) rspec-core (3.6.0) rspec-support (~> 3.6.0) rspec-expectations (3.6.0) @@ -211,7 +262,11 @@ GEM rspec-mocks (~> 3.6.0) rspec-support (~> 3.6.0) rspec-support (3.6.0) + ruby-ole (1.2.12.1) ruby_dep (1.5.0) + rubyvis (0.6.1) + rufus-scheduler (3.0.7) + tzinfo safe_yaml (1.0.4) sass (3.4.25) sass-rails (5.0.6) @@ -220,7 +275,13 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) + sequel (4.9.0) + sequel-jdbc-hive2-adapter (0.0.2) slop (3.6.0) + spoon (0.0.4) + ffi + spreadsheet (1.1.4) + ruby-ole (>= 1.0) sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -229,8 +290,22 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) + standard_deviation (1.0.3) + statistica (0.1.0) + statsample (2.0.2) + awesome_print (~> 1.6) + daru (~> 0.1) + dirty-memoize (~> 0.0.4) + distribution (~> 0.7) + extendmatrix (~> 0.4) + minimization (~> 0.2) + reportbuilder (~> 1.4) + rserve-client (~> 0.3) + rubyvis (~> 0.6.1) + spreadsheet (~> 1.1) tether-rails (1.4.0) rails (>= 3.1) + text-table (1.2.4) thor (0.19.4) thread_safe (0.3.6) tilt (2.0.7) @@ -243,6 +318,8 @@ GEM tzinfo (>= 1.0.0) uglifier (3.2.0) execjs (>= 0.3.0, < 3) + uri_template (0.7.0) + variance (0.2.0) web-console (3.5.1) actionview (>= 5.0) activemodel (>= 5.0) @@ -271,6 +348,8 @@ DEPENDENCIES byebug capybara chronic + descriptive-statistics + descriptive_statistics (~> 2.5, >= 2.5.1) dotenv-rails factory_girl_rails firstdraft_generators @@ -280,17 +359,24 @@ DEPENDENCIES jquery-rails letter_opener listen (>= 3.0.5, < 3.2) + mean_median_mode (~> 0.3.0) meta_request + mode (~> 0.0.26) momentjs-rails pry-rails puma (~> 3.7) + quickstats (~> 2.0) rails (~> 5.1.2) rspec-rails sass-rails (~> 5.0) sqlite3 + standard_deviation (~> 1.0, >= 1.0.3) + statistica (~> 0.1.0) + statsample (~> 2.0, >= 2.0.2) turbolinks (~> 5) tzinfo-data uglifier (>= 1.3.0) + variance (~> 0.2.0) wdm web-console (>= 3.3.0) web_git! diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index b7250bf..492a993 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -86,33 +86,35 @@ 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 = @numbers.count @minimum = @numbers.min @maximum = @numbers.max - @range = "Replace this string with your answer." + @range = @maximum-@minimum - @median = "Replace this string with your answer." + @median = @sorted_numbers[((@count/2)+(1/2))] - @sum = "Replace this string with your answer." + @sum = @numbers.sum - @mean = "Replace this string with your answer." + @mean = @sum/@count - @variance = "Replace this string with your answer." + @variance = @numbers.variance - @standard_deviation = "Replace this string with your answer." + @standard_deviation = @numbers.standard_deviation - @mode = "Replace this string with your answer." + @mode = @numbers.mode # ================================================================================ # Your code goes above. From 3fa000b0096dc4f0ba5081ce526ccf5fad737cbc Mon Sep 17 00:00:00 2001 From: Em Klick Date: Sun, 9 Jul 2017 00:05:59 +0000 Subject: [PATCH 06/12] 23e --- app/controllers/calculations_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index 492a993..9b43934 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -113,8 +113,10 @@ def descriptive_statistics @variance = @numbers.variance @standard_deviation = @numbers.standard_deviation + + occurance = @sorted_numbers - @mode = @numbers.mode + @mode = @sorted_numbers-@numbers # ================================================================================ # Your code goes above. From e9a8952739505bdf74b2054d772e522917ecdc28 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Sun, 9 Jul 2017 23:43:14 +0000 Subject: [PATCH 07/12] 678 --- Gemfile | 18 ----------- Gemfile.lock | 86 ---------------------------------------------------- 2 files changed, 104 deletions(-) diff --git a/Gemfile b/Gemfile index aedab42..a205ed5 100644 --- a/Gemfile +++ b/Gemfile @@ -76,22 +76,4 @@ gem 'bootstrap', '~> 4.0.0.alpha6' gem 'jquery-rails' gem 'font-awesome-sass', '~> 4.7.0' -gem 'descriptive-statistics' - -gem 'variance', '~> 0.2.0' - -gem 'standard_deviation', '~> 1.0', '>= 1.0.3' - -gem 'mode', '~> 0.0.26' - - -gem 'mean_median_mode', '~> 0.3.0' - -gem 'descriptive_statistics', '~> 2.5', '>= 2.5.1' - -gem 'quickstats', '~> 2.0' - -gem 'statsample', '~> 2.0', '>= 2.0.2' - -gem 'statistica', '~> 0.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 1991775..0ba3ccd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -65,7 +65,6 @@ GEM autoprefixer-rails (7.1.2.1) execjs awesome_print (1.8.0) - backports (3.8.0) better_errors (2.1.1) coderay (>= 1.0.0) erubis (>= 2.6.6) @@ -89,19 +88,12 @@ GEM rack-test (>= 0.5.4) xpath (~> 2.0) chronic (0.10.2) - clbustos-rtf (0.4.2) coderay (1.1.1) concurrent-ruby (1.0.5) crack (0.4.3) safe_yaml (~> 1.0.0) - daru (0.1.5) - backports debug_inspector (0.0.3) - descriptive-statistics (2.2.0) - descriptive_statistics (2.5.1) diff-lcs (1.3) - dirty-memoize (0.0.4) - distribution (0.7.3) dotenv (2.2.1) dotenv-rails (2.2.1) dotenv (= 2.2.1) @@ -109,16 +101,11 @@ GEM erubi (1.6.1) erubis (2.7.0) execjs (2.7.0) - extendmatrix (0.4) factory_girl (4.8.0) activesupport (>= 3.0.0) factory_girl_rails (4.8.0) factory_girl (~> 4.8.0) railties (>= 3.0.0) - faraday (0.9.0) - multipart-post (>= 1.2, < 3) - faraday_middleware (0.9.1) - faraday (>= 0.7.4, < 0.10) ffi (1.9.18) firstdraft_generators (0.0.3) font-awesome-sass (4.7.0) @@ -130,10 +117,6 @@ GEM jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) - jdbc-hive2 (0.11.0.1) - jdbc-jtds (1.3.1) - jdbc-mysql (5.1.28) - jdbc-postgres (9.3.1101) jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -150,7 +133,6 @@ GEM nokogiri (>= 1.5.9) mail (2.6.6) mime-types (>= 1.16, < 4) - mean_median_mode (0.3.0) meta_request (0.4.3) callsite (~> 0.0, >= 0.0.11) rack-contrib (>= 1.1, < 3) @@ -160,27 +142,10 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_portile2 (2.2.0) - minimization (0.2.3) - text-table (~> 1.2) minitest (5.10.2) - mode (0.0.26) - faraday (= 0.9.0) - faraday_middleware (= 0.9.1) - jdbc-hive2 - jdbc-jtds (= 1.3.1) - jdbc-mysql (= 5.1.28) - jdbc-postgres (= 9.3.1101) - multipart-post (= 1.2.0) - rufus-scheduler (= 3.0.7) - sequel (= 4.9.0) - sequel-jdbc-hive2-adapter - spoon (= 0.0.4) - thor (~> 0.19.1) - uri_template (= 0.7.0) momentjs-rails (2.17.1) railties (>= 3.1) multi_json (1.12.1) - multipart-post (1.2.0) nio4r (2.1.0) nokogiri (1.8.0) mini_portile2 (~> 2.2.0) @@ -189,15 +154,6 @@ GEM octicons_helper (3.0.1) octicons (~> 3.0) rails - prawn (0.8.4) - prawn-core (>= 0.8.4, < 0.9) - prawn-layout (>= 0.8.4, < 0.9) - prawn-security (>= 0.8.4, < 0.9) - prawn-core (0.8.4) - prawn-layout (0.8.4) - prawn-security (0.8.4) - prawn-svg (0.9.1.11) - prawn (>= 0.8.4) pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) @@ -206,7 +162,6 @@ GEM pry (>= 0.10.4) public_suffix (2.0.5) puma (3.9.1) - quickstats (2.0.0) rack (2.0.3) rack-contrib (1.2.0) rack (>= 0.9.1) @@ -239,12 +194,6 @@ GEM rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) - reportbuilder (1.4.2) - clbustos-rtf (~> 0.4.0) - prawn (~> 0.8.4) - prawn-svg (~> 0.9.1) - text-table (~> 1.2) - rserve-client (0.3.3) rspec-core (3.6.0) rspec-support (~> 3.6.0) rspec-expectations (3.6.0) @@ -262,11 +211,7 @@ GEM rspec-mocks (~> 3.6.0) rspec-support (~> 3.6.0) rspec-support (3.6.0) - ruby-ole (1.2.12.1) ruby_dep (1.5.0) - rubyvis (0.6.1) - rufus-scheduler (3.0.7) - tzinfo safe_yaml (1.0.4) sass (3.4.25) sass-rails (5.0.6) @@ -275,13 +220,7 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sequel (4.9.0) - sequel-jdbc-hive2-adapter (0.0.2) slop (3.6.0) - spoon (0.0.4) - ffi - spreadsheet (1.1.4) - ruby-ole (>= 1.0) sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -290,22 +229,8 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) - standard_deviation (1.0.3) - statistica (0.1.0) - statsample (2.0.2) - awesome_print (~> 1.6) - daru (~> 0.1) - dirty-memoize (~> 0.0.4) - distribution (~> 0.7) - extendmatrix (~> 0.4) - minimization (~> 0.2) - reportbuilder (~> 1.4) - rserve-client (~> 0.3) - rubyvis (~> 0.6.1) - spreadsheet (~> 1.1) tether-rails (1.4.0) rails (>= 3.1) - text-table (1.2.4) thor (0.19.4) thread_safe (0.3.6) tilt (2.0.7) @@ -318,8 +243,6 @@ GEM tzinfo (>= 1.0.0) uglifier (3.2.0) execjs (>= 0.3.0, < 3) - uri_template (0.7.0) - variance (0.2.0) web-console (3.5.1) actionview (>= 5.0) activemodel (>= 5.0) @@ -348,8 +271,6 @@ DEPENDENCIES byebug capybara chronic - descriptive-statistics - descriptive_statistics (~> 2.5, >= 2.5.1) dotenv-rails factory_girl_rails firstdraft_generators @@ -359,24 +280,17 @@ DEPENDENCIES jquery-rails letter_opener listen (>= 3.0.5, < 3.2) - mean_median_mode (~> 0.3.0) meta_request - mode (~> 0.0.26) momentjs-rails pry-rails puma (~> 3.7) - quickstats (~> 2.0) rails (~> 5.1.2) rspec-rails sass-rails (~> 5.0) sqlite3 - standard_deviation (~> 1.0, >= 1.0.3) - statistica (~> 0.1.0) - statsample (~> 2.0, >= 2.0.2) turbolinks (~> 5) tzinfo-data uglifier (>= 1.3.0) - variance (~> 0.2.0) wdm web-console (>= 3.3.0) web_git! From b09a1477a5c70b5a3f76195f24263735d2917920 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Tue, 18 Jul 2017 01:08:27 +0000 Subject: [PATCH 08/12] sdfghjkkjhv --- app/controllers/calculations_controller.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/calculations_controller.rb b/app/controllers/calculations_controller.rb index 9b43934..1b5287e 100644 --- a/app/controllers/calculations_controller.rb +++ b/app/controllers/calculations_controller.rb @@ -110,13 +110,17 @@ def descriptive_statistics @mean = @sum/@count - @variance = @numbers.variance + @demeaned=@numbers.map { |i| i - @mean} + @squared = @demeaned.map { |i| i**2} + @variance = @squared.sum / @count - @standard_deviation = @numbers.standard_deviation - - occurance = @sorted_numbers + @variance = @squared.sum / @count + + @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])] - @mode = @sorted_numbers-@numbers # ================================================================================ # Your code goes above. From 450ed297420918128a1d490d45592a9b7c92f109 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Tue, 18 Jul 2017 01:09:29 +0000 Subject: [PATCH 09/12] cvghjuytdf --- app/assets/javascripts/application.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ff5cbac..9d1a823 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,6 +11,7 @@ // about supported directives. // //= require rails-ujs +//= require jquery //= require bootstrap //= require turbolinks //= require_tree . From eeaef67634f1b88bdf60955a256e77ba8f779718 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Tue, 18 Jul 2017 01:14:50 +0000 Subject: [PATCH 10/12] cvbnmbvbnmn --- Gemfile.lock | 12 ++++++++---- app/assets/javascripts/application.js | 1 - 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0ba3ccd..63608e6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/firstdraft/grade_runner.git - revision: dabf435a51bb4742f4c5b863d9f232c34f85ba87 + 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.2.1) + autoprefixer-rails (7.1.2.3) execjs awesome_print (1.8.0) better_errors (2.1.1) @@ -113,7 +113,7 @@ GEM globalid (0.4.0) activesupport (>= 4.2.0) hashdiff (0.3.4) - i18n (0.8.5) + i18n (0.8.6) jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) @@ -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.1) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 9d1a823..2791911 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -17,7 +17,6 @@ //= require_tree . -//= require jquery //= require moment //= require bootstrap-datetimepicker From da0076abb45fc788fcd0ba3acd54499f248fafab Mon Sep 17 00:00:00 2001 From: Em Klick Date: Thu, 20 Jul 2017 00:42:49 +0000 Subject: [PATCH 11/12] Update rake task --- lib/tasks/project.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/project.rake b/lib/tasks/project.rake index 253d60c..0c36650 100644 --- a/lib/tasks/project.rake +++ b/lib/tasks/project.rake @@ -2,7 +2,7 @@ namespace :project do desc "Attempt to update project, if there are no conflicts" task :update do if `git config remote.upstream.url`.blank? - `git remote add upstream git@github.com:appdevspring17/omnicalc_ruby.git` + `git remote add upstream git@github.com:appdevsummer17/omnicalc_ruby.git` end `git fetch upstream` From 76996cda86d9bc0436f9778c1bd32cbe30b7bef2 Mon Sep 17 00:00:00 2001 From: Em Klick Date: Thu, 20 Jul 2017 00:44:24 +0000 Subject: [PATCH 12/12] Update project --- spec/json_output_formatter.rb | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 spec/json_output_formatter.rb diff --git a/spec/json_output_formatter.rb b/spec/json_output_formatter.rb new file mode 100644 index 0000000..b37da1d --- /dev/null +++ b/spec/json_output_formatter.rb @@ -0,0 +1,51 @@ +RSpec::Support.require_rspec_core "formatters/json_formatter" + +class JsonOutputFormatter < RSpec::Core::Formatters::JsonFormatter + RSpec::Core::Formatters.register self, :dump_summary + + def dump_summary(summary) + total_points = summary. + examples. + map { |example| example.metadata[:points].to_i }. + sum + + earned_points = summary. + examples. + select { |example| example.execution_result.status == :passed }. + map { |example| example.metadata[:points].to_i }. + sum + + @output_hash[:summary] = { + duration: summary.duration, + example_count: summary.example_count, + failure_count: summary.failure_count, + pending_count: summary.pending_count, + total_points: total_points, + earned_points: earned_points, + score: (earned_points.to_f / total_points).round(4) + } + + @output_hash[:summary_line] = [ + "#{summary.example_count} tests", + "#{summary.failure_count} failures", + "#{earned_points}/#{total_points} points", + "#{@output_hash[:summary][:score] * 100}%", + ].join(", ") + end + + private + + def format_example(example) + { + description: example.description, + full_description: example.full_description, + hint: example.metadata[:hint], + status: example.execution_result.status.to_s, + points: example.metadata[:points], + file_path: example.metadata[:file_path], + line_number: example.metadata[:line_number], + run_time: example.execution_result.run_time, + } + end + +end \ No newline at end of file