Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@ end
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'
20 changes: 16 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/firstdraft/grade_runner.git
revision: 881cce30367bc9a5f15a3e4ac4cb48599dbecec2
revision: 83db5d2b90086055aa3204afe38a18394aecea16
specs:
grade_runner (0.0.1)

Expand Down Expand Up @@ -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.2)
execjs
awesome_print (1.8.0)
better_errors (2.1.1)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -208,7 +213,11 @@ GEM
rspec-support (3.6.0)
ruby_dep (1.5.0)
safe_yaml (1.0.4)
sass (3.4.24)
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)
Expand Down Expand Up @@ -262,8 +271,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
Expand All @@ -274,6 +285,7 @@ DEPENDENCIES
letter_opener
listen (>= 3.0.5, < 3.2)
meta_request
momentjs-rails
pry-rails
puma (~> 3.7)
rails (~> 5.1.2)
Expand Down
9 changes: 9 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
// about supported directives.
//
//= require rails-ujs
//= require jquery
//= require bootstrap
//= require turbolinks
//= require_tree .


//= require moment
//= require bootstrap-datetimepicker

$(function () {
$('.datetimepicker').datetimepicker();
});
61 changes: 39 additions & 22 deletions app/controllers/calculations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ machine:
ruby:
version:
2.3.1
database:
override:
- bin/setup

test:
override:
- COVERAGE=true bin/rails grade_runner:runner