commit
b871285c75
@ -1,28 +1,52 @@
|
||||
# https://github.com/sasstools/sass-lint/tree/master/docs/rules
|
||||
files:
|
||||
include: app/assets/stylesheets/**/*.scss
|
||||
include: site/**/*.scss
|
||||
ignore:
|
||||
- site/assets/scss/*bootstrap*
|
||||
|
||||
options:
|
||||
formatter: stylish
|
||||
merge-default-rules: true
|
||||
|
||||
# https://github.com/sasstools/sass-lint/tree/master/docs/rules
|
||||
rules:
|
||||
class-name-format: 0
|
||||
|
||||
class-name-format:
|
||||
- 1
|
||||
- convention: 'hyphenatedbem'
|
||||
|
||||
force-pseudo-nesting: 0
|
||||
|
||||
id-name-format: 0
|
||||
|
||||
leading-zero:
|
||||
- 1
|
||||
- include: true
|
||||
no-duplicate-properties:
|
||||
|
||||
nesting-depth:
|
||||
- 1
|
||||
- max-depth: 4
|
||||
|
||||
no-css-comments: 0
|
||||
|
||||
no-color-literals:
|
||||
- 1
|
||||
-
|
||||
exclude:
|
||||
- src # for @font mixins
|
||||
allow-rgba: true
|
||||
|
||||
no-duplicate-properties: 1
|
||||
|
||||
no-qualifying-elements:
|
||||
- 1
|
||||
- allow-element-with-attribute: true # input[type='email'] but not div.class-name
|
||||
quotes: 0
|
||||
no-vendor-prefixes:
|
||||
|
||||
no-vendor-prefixes: 1
|
||||
|
||||
property-sort-order:
|
||||
- 1
|
||||
-
|
||||
excluded-identifiers:
|
||||
- -moz-osx-font-smoothing
|
||||
- -webkit-font-smoothing
|
||||
# https://github.com/sasstools/sass-lint/blob/develop/lib/config/property-sort-orders/concentric.yml
|
||||
order: concentric
|
||||
# https://github.com/sasstools/sass-lint/blob/develop/lib/config/property-sort-orders/smacss.yml
|
||||
# order: smacss
|
||||
|
||||
quotes: 0
|
||||
|
2
Gemfile
2
Gemfile
@ -9,6 +9,7 @@ gem 'rails', '~> 5.0', '>= 5.0.1'
|
||||
gem 'jbuilder', '~> 2.6'
|
||||
gem 'jquery-rails'
|
||||
gem 'json', '~> 2.0.2'
|
||||
gem 'kaminari'
|
||||
gem 'mailjet', '~> 1.3.8'
|
||||
gem 'puma', '~> 3.0'
|
||||
gem 'pundit'
|
||||
@ -53,6 +54,7 @@ group :development, :test do
|
||||
gem 'byebug', platform: :mri
|
||||
gem 'pry-byebug'
|
||||
gem 'pry-rails'
|
||||
gem 'faker'
|
||||
|
||||
gem 'brakeman'
|
||||
gem 'rubocop', '~> 0.42.0'
|
||||
|
18
Gemfile.lock
18
Gemfile.lock
@ -72,6 +72,8 @@ GEM
|
||||
erubis (2.7.0)
|
||||
eventmachine (1.2.1)
|
||||
execjs (2.7.0)
|
||||
faker (1.7.3)
|
||||
i18n (~> 0.5)
|
||||
ffi (1.9.14)
|
||||
figaro (1.1.1)
|
||||
thor (~> 0.14)
|
||||
@ -122,6 +124,18 @@ GEM
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (2.0.3)
|
||||
kaminari (1.0.1)
|
||||
activesupport (>= 4.1.0)
|
||||
kaminari-actionview (= 1.0.1)
|
||||
kaminari-activerecord (= 1.0.1)
|
||||
kaminari-core (= 1.0.1)
|
||||
kaminari-actionview (1.0.1)
|
||||
actionview
|
||||
kaminari-core (= 1.0.1)
|
||||
kaminari-activerecord (1.0.1)
|
||||
activerecord
|
||||
kaminari-core (= 1.0.1)
|
||||
kaminari-core (1.0.1)
|
||||
listen (3.1.5)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
@ -300,6 +314,7 @@ DEPENDENCIES
|
||||
bourbon
|
||||
brakeman
|
||||
byebug
|
||||
faker
|
||||
figaro (~> 1.1.1)
|
||||
guard
|
||||
guard-brakeman
|
||||
@ -311,6 +326,7 @@ DEPENDENCIES
|
||||
jbuilder (~> 2.6)
|
||||
jquery-rails
|
||||
json (~> 2.0.2)
|
||||
kaminari
|
||||
listen
|
||||
mailjet (~> 1.3.8)
|
||||
minitest-reporters
|
||||
@ -338,4 +354,4 @@ DEPENDENCIES
|
||||
web-console
|
||||
|
||||
BUNDLED WITH
|
||||
1.13.2
|
||||
1.13.3
|
||||
|
@ -14,6 +14,7 @@ module Admin
|
||||
@candidates = Candidate.where(completed: true)
|
||||
.includes(:recruiter)
|
||||
.order("#{sort_column} #{sort_direction}")
|
||||
.page(params[:page])
|
||||
end
|
||||
|
||||
def view
|
||||
|
69
app/services/fake_quiz.rb
Normal file
69
app/services/fake_quiz.rb
Normal file
@ -0,0 +1,69 @@
|
||||
# frozen_string_literal: true
|
||||
class FakeQuiz
|
||||
def create_completed_quizzes num = 10
|
||||
num.times do
|
||||
candidate = create_candidate Faker::Name.name
|
||||
answer_questions candidate
|
||||
candidate.update_attributes(completed: true, completed_at: Time.zone.now - rand(0..112).days)
|
||||
candidate.build_reviews
|
||||
end
|
||||
end
|
||||
|
||||
def create_candidate name
|
||||
Candidate.create(name: name,
|
||||
email: "#{Faker::Internet.user_name(name)}@mailinator.com",
|
||||
experience: rando_experience,
|
||||
project: Faker::Company.name,
|
||||
recruiter_id: recruiter_id,
|
||||
quiz_id: fed_quiz_id)
|
||||
end
|
||||
|
||||
def answer_questions candidate
|
||||
candidate.quiz.questions.each do |question|
|
||||
candidate.answers.create(question_id: question.id,
|
||||
answer: generate_answer(question),
|
||||
submitted: true)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def fed_quiz_id
|
||||
Quiz.find_by(dept: 'fed').id
|
||||
end
|
||||
|
||||
def recruiter_id
|
||||
User.find_by(name: 'Sam Recruiter').id
|
||||
end
|
||||
|
||||
def rando_experience
|
||||
%w(0-3 4-6 7-9 10-14 15+)[rand(0..4)]
|
||||
end
|
||||
|
||||
def generate_answer question # rubocop:disable Metrics/MethodLength
|
||||
case question.input_type
|
||||
when "checkbox"
|
||||
question.input_options
|
||||
when "checkbox_other"
|
||||
{
|
||||
other: Faker::TwinPeaks.quote,
|
||||
options: question.input_options
|
||||
}
|
||||
when "radio"
|
||||
question.input_options.sample
|
||||
when "radio_other"
|
||||
{
|
||||
other: Faker::TwinPeaks.quote,
|
||||
options: question.input_options.sample
|
||||
}
|
||||
when "live_code"
|
||||
{
|
||||
html: "<p>#{Faker::TwinPeaks.quote}</p>",
|
||||
css: "body {color: #{Faker::Color.hex_color}}",
|
||||
text: Faker::TwinPeaks.quote
|
||||
}
|
||||
else
|
||||
Faker::TwinPeaks.quote
|
||||
end
|
||||
end # rubocop:enable Metrics/MethodLength
|
||||
end
|
@ -24,4 +24,5 @@
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<%= paginate @candidates %>
|
||||
</main>
|
||||
|
12
config/initializers/kaminari_config.rb
Normal file
12
config/initializers/kaminari_config.rb
Normal file
@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
Kaminari.configure do |config|
|
||||
config.default_per_page = 10
|
||||
# config.max_per_page = nil
|
||||
# config.window = 4
|
||||
# config.outer_window = 0
|
||||
# config.left = 0
|
||||
# config.right = 0
|
||||
# config.page_method_name = :page
|
||||
# config.param_name = :page
|
||||
# config.params_on_first_page = false
|
||||
end
|
10
lib/tasks/faker.rake
Normal file
10
lib/tasks/faker.rake
Normal file
@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
namespace :faker do
|
||||
desc "Generates 10 fake candidates with results."
|
||||
task results: :environment do
|
||||
puts "Not for production use" and return if Rails.env == "production"
|
||||
|
||||
faker = FakeQuiz.new
|
||||
faker.create_completed_quizzes 10
|
||||
end
|
||||
end
|
12
test/fixtures/candidates.yml
vendored
12
test/fixtures/candidates.yml
vendored
@ -63,7 +63,7 @@ richard: # Richard has completed AND submitted the test
|
||||
recruiter: recruiter
|
||||
quiz: fed
|
||||
completed: true
|
||||
completed_at: <%= DateTime.current %>
|
||||
completed_at: <%= DateTime.current - 20.days %>
|
||||
reminded: false
|
||||
test_hash: 6NjnourLE6Y
|
||||
review_status: 1
|
||||
@ -87,7 +87,7 @@ stacy: # Stacy has completed AND submitted the test
|
||||
recruiter: recruiter
|
||||
quiz: fed
|
||||
completed: true
|
||||
completed_at: <%= DateTime.current %>
|
||||
completed_at: <%= DateTime.current - 13.hours %>
|
||||
reminded: false
|
||||
test_hash: s6oFExZliYYFx
|
||||
review_status: 2
|
||||
@ -100,7 +100,7 @@ henry: # Henry has completed AND submitted the test
|
||||
recruiter: recruiter
|
||||
quiz: fed
|
||||
completed: true
|
||||
completed_at: <%= DateTime.current %>
|
||||
completed_at: <%= DateTime.current - 3.days %>
|
||||
reminded: false
|
||||
test_hash: egPomAuVDeCEp
|
||||
|
||||
@ -112,7 +112,7 @@ wade: # Wade has completed AND submitted the test
|
||||
recruiter: recruiter
|
||||
quiz: fed
|
||||
completed: true
|
||||
completed_at: <%= DateTime.current %>
|
||||
completed_at: <%= DateTime.current - 8.days %>
|
||||
reminded: false
|
||||
test_hash: BkSkpapJnkz2N
|
||||
|
||||
@ -124,7 +124,7 @@ jorge: # Jorge has completed AND submitted the test
|
||||
recruiter: recruiter
|
||||
quiz: fed
|
||||
completed: true
|
||||
completed_at: <%= DateTime.current %>
|
||||
completed_at: <%= DateTime.current - 12.days + 3.hours %>
|
||||
reminded: false
|
||||
test_hash: iC5FdWJxcyySBmpOpU
|
||||
|
||||
@ -136,7 +136,7 @@ elsie: # Elsie has completed AND submitted the test
|
||||
recruiter: recruiter
|
||||
quiz: fed
|
||||
completed: true
|
||||
completed_at: <%= DateTime.current %>
|
||||
completed_at: <%= DateTime.current - 45.days + 6.hours %>
|
||||
reminded: false
|
||||
test_hash: rLSoizA3ATMNSCx
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user