Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Commit

Permalink
v0.1.6
Browse files Browse the repository at this point in the history
Merge pull request #21 from TechforgoodCAST/dev
  • Loading branch information
suninthesky authored Jan 17, 2020
2 parents ef12729 + 21dfde9 commit 2153d69
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 74 deletions.
18 changes: 0 additions & 18 deletions .babelrc

This file was deleted.

6 changes: 6 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@ class ApplicationController < ActionController::Base
def render_status(status)
render file: "#{Rails.root}/public/#{status}.html", status: status
end

def parse_date
@date = params[:date]&.to_date || Date.today
rescue ArgumentError
@date = Date.today
end
end
4 changes: 1 addition & 3 deletions app/controllers/partners_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
class PartnersController < ApplicationController
before_action :authenticate_user!
before_action :authenticate_user!, :parse_date

def index
@date = params[:date]&.to_date || Date.today

@usage ||= Referral.joins(:partner).used
.by_month(@date, col: 'referrals.created_at')
.group('partners.slug').size
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/referrals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@ def show
def load_partner
@partner = Partner.active.find_by(slug: params[:slug])
end

def parse_date
@date = params[:date]&.to_date || Date.today
end
end
6 changes: 6 additions & 0 deletions test/system/month_picker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ class MonthPickerTest < ApplicationSystemTestCase
sign_in
assert_text('No referrals this month.')
end

test 'invalid date returns current day' do
visit root_path(date: '2020-1')
sign_in
assert_text("#{Date::MONTHNAMES[Date.today.month]} Referrals #{Date.today.year}")
end
end
49 changes: 0 additions & 49 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4545,14 +4545,6 @@ minipass@^2.2.1, minipass@^2.3.3:
safe-buffer "^5.1.2"
yallist "^3.0.0"

minipass@^2.8.6, minipass@^2.9.0:
version "2.9.0"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6"
integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==
dependencies:
safe-buffer "^5.1.2"
yallist "^3.0.0"

minipass@^3.0.0, minipass@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.1.tgz#7607ce778472a185ad6d89082aa2070f79cedcd5"
Expand All @@ -4567,13 +4559,6 @@ minizlib@^1.1.0:
dependencies:
minipass "^2.2.1"

minizlib@^1.2.1:
version "1.3.3"
resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d"
integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==
dependencies:
minipass "^2.9.0"

mississippi@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022"
Expand Down Expand Up @@ -4753,22 +4738,6 @@ node-libs-browser@^2.2.1:
util "^0.11.0"
vm-browserify "^1.0.1"

node-pre-gyp@*:
version "0.14.0"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.14.0.tgz#9a0596533b877289bcad4e143982ca3d904ddc83"
integrity sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA==
dependencies:
detect-libc "^1.0.2"
mkdirp "^0.5.1"
needle "^2.2.1"
nopt "^4.0.1"
npm-packlist "^1.1.6"
npmlog "^4.0.2"
rc "^1.2.7"
rimraf "^2.6.1"
semver "^5.3.0"
tar "^4.4.2"

node-pre-gyp@^0.10.0:
version "0.10.3"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc"
Expand Down Expand Up @@ -7158,19 +7127,6 @@ tar@^4:
safe-buffer "^5.1.2"
yallist "^3.0.2"

tar@^4.4.2:
version "4.4.13"
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525"
integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==
dependencies:
chownr "^1.1.1"
fs-minipass "^1.2.5"
minipass "^2.8.6"
minizlib "^1.2.1"
mkdirp "^0.5.0"
safe-buffer "^5.1.2"
yallist "^3.0.3"

terser-webpack-plugin@^1.4.3:
version "1.4.3"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz#5ecaf2dbdc5fb99745fd06791f46fc9ddb1c9a7c"
Expand Down Expand Up @@ -7773,11 +7729,6 @@ yallist@^3.0.0, yallist@^3.0.2:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9"
integrity sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=

yallist@^3.0.3:
version "3.1.1"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==

yallist@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
Expand Down

0 comments on commit 2153d69

Please sign in to comment.