All Files (98.69% covered at 2.35 hits/line)
104 files in total.
1142 relevant lines.
1127 lines covered and
15 lines missed
- 1
class AdditionalsController < ApplicationController
- 1
def create
- 1
@additional = Additional.new(additional_params)
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@additional.daycare = @daycare
- 1
@additional.save
#create new additional to display create additional form so users can add more programs
- 1
@additional = Additional.new
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def edit
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@additional = Additional.find(params[:id])
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def update
- 1
@additional = Additional.find(params[:id])
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@additional.update(additional_params)
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def destroy
- 2
@additional = Additional.find(params[:id])
- 1
@additional.destroy
end
- 1
def move
@daycare = Daycare.find(params[:daycare_id])
params['additional'].each_with_index do |id, index|
additional = Additional.find(id)
additional.update_attribute(:position, index+1) if additional
end
render nothing: true
end
- 1
private
- 1
def additional_params
- 2
params.require(:additional).permit(:title, :content, :image, :id, :position)
end
end
- 1
class AddressesController < ApplicationController
- 1
def create
- 1
@address = Address.new(address_params)
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@address.daycare = @daycare
- 1
@address.save
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def update
- 1
@address = Address.find(params[:id])
- 1
@daycare = current_user.daycare
- 1
@address.update(address_params)
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
private
- 1
def address_params
- 2
params.require(:address).permit(:street, :city, :state, :zip)
end
end
- 1
class ApplicationController < ActionController::Base
- 1
before_action :configure_permitted_parameters, if: :devise_controller?
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
- 1
protect_from_forgery with: :exception
- 1
protected
- 1
def configure_permitted_parameters
- 15
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:user_name, :email, :password, :password_confirmation, :remember_me) }
- 17
devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :user_name, :email, :password, :remember_me) }
- 13
devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:user_name, :email, :password, :password_confirmation, :current_password) }
end
- 1
def after_sign_in_path_for(resource)
- 5
if current_user.daycare.nil?
- 4
new_user_daycare_path(current_user)
else
- 1
@daycare = Daycare.find(current_user.daycare.id)
- 1
user_daycare_path(current_user, @daycare)
end
end
end
- 1
class CertificationsController < ApplicationController
- 1
def create
- 1
@certification = Certification.new(cert_params)
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@certification.daycare = @daycare
- 1
@certification.save
#create new certification to display create certification form so users can add more programs
- 1
@certification = Certification.new
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def destroy
- 2
@certification = Certification.find(params[:id])
- 1
@certification.destroy
end
- 1
private
- 1
def cert_params
- 1
params.require(:certification).permit(:name, :description, :image, :id, :position)
end
end
- 1
class ContactsController < ApplicationController
- 1
def create
- 1
@contact = Contact.new(contact_params)
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@contact.daycare = @daycare
- 1
@contact.save
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def update
- 1
@contact = Contact.find(params[:id])
- 1
@daycare = current_user.daycare
- 1
@contact.update(contact_params)
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
private
- 1
def contact_params
- 2
params.require(:contact).permit(:email, :phone)
end
end
- 1
class DaycaresController < ApplicationController
- 1
before_action :authenticate_user!, except: [:show]
- 1
def show
- 26
@daycare = Daycare.find(params[:id])
- 26
if @daycare.address.nil? #if user has not added contact information
- 23
@address = Address.new
else
- 3
@address = @daycare.address
end
- 26
if @daycare.contact.nil? #if user has not added contact information
- 24
@contact = Contact.new
else
- 2
@contact = @daycare.contact
end
- 26
if @daycare.summary.nil?
- 24
@summary = Summary.new
else
- 2
@summary = @daycare.summary
end
- 26
if @daycare.images.any? == false
- 24
@image = Image.new
- 24
@images = []
else
- 2
@images = @daycare.images.order("position")
- 2
@image_first = @images.first
- 2
@images = @images.drop(1)
end
- 26
if @daycare.programs.any? == false
- 23
@program = Program.new
- 23
@programs = []
else
- 3
@programs = @daycare.programs.order("position")
end
- 26
if @daycare.teachers.any? == false
- 23
@teachers = Program.new
- 23
@teachers = []
else
- 3
@teachers = @daycare.teachers.order("position")
end
- 26
if @daycare.certifications.any? == false
- 25
@certification = Certification.new
- 25
@certifications = []
else
- 1
@certifications = @daycare.certifications.order("position")
end
- 26
if @daycare.additionals.any? == false
- 24
@additional = Additional.new
- 24
@additionals = []
else
- 2
@additionals = @daycare.additionals.order("position")
end
end
- 1
def new
- 5
@daycare = Daycare.new
end
- 1
def create
- 1
@daycare = Daycare.new(daycare_params)
- 1
@user = User.find(params[:user_id])
- 1
@daycare.user = @user
- 1
@daycare.save
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def edit
- 27
@daycare = Daycare.find(params[:id])
- 27
if @daycare.contact.nil? #if user has not added contact information
- 26
@contact = Contact.new
else
- 1
@contact = @daycare.contact
end
- 27
if @daycare.summary.nil?
- 25
@summary = Summary.new
else
- 2
@summary = @daycare.summary
end
- 27
if @daycare.address.nil? #if user has not added address
- 25
@address = Address.new
else
- 2
@address = @daycare.address
end
- 27
if @daycare.images.any?
@images = @daycare.images.order("position")
else
- 27
@images = []
end
- 27
@image = Image.new
- 27
if @daycare.programs.any?
- 3
@programs = @daycare.programs.order("position")
else
- 24
@programs = []
end
- 27
@program = Program.new
- 27
if @daycare.certifications.any?
- 1
@certifications = @daycare.certifications.order("position")
else
- 26
@certifications = []
end
- 27
@certification = Certification.new
- 27
if @daycare.teachers.any?
- 3
@teachers = @daycare.teachers.order("position")
else
- 24
@teachers = []
end
- 27
@teacher = Teacher.new
- 27
if @daycare.additionals.any?
- 2
@additionals = @daycare.additionals.order("position")
else
- 25
@additionals = []
end
- 27
@additional = Additional.new
- 27
respond_to do |format|
- 27
format.html
- 27
format.js
end
end
- 1
def update
- 1
@user = User.find(params[:user_id])
- 1
@daycare = Daycare.find(params[:id])
- 1
@daycare.user = @user
- 1
@daycare.update(daycare_params)
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
private
- 1
def daycare_params
- 2
params.require(:daycare).permit(:name, :structure)
end
end
- 1
class HomeController < ApplicationController
- 1
def index
end
- 1
def show
- 3
@address = params[:search]
- 3
@radius = params["radius-value"]
- 3
@destination = Address.where("state = 'OR'")
- 3
@daycares = []
- 3
@images = []
- 3
@destination.each do |address|
- 3
@daycares.push(address.daycare)
- 3
if address.daycare.images.any?
image = address.daycare.images.first.image_url
else
- 3
image = nil
end
- 3
@images.push(image)
end
- 3
@destination = @destination.to_json
- 3
@daycares = @daycares.to_json
- 3
@images = @images.to_json
end
end
- 1
class ImagesController < ApplicationController
- 1
def create
- 3
@daycare = Daycare.find(params[:daycare_id])
- 3
@image = Image.new(image_params)
- 3
@image.daycare = @daycare
- 3
@image.save
- 3
@images = @daycare.images
#create new image to display create image form so users can add more images
- 3
@image = Image.new
- 3
respond_to do |format|
- 3
format.html
- 3
format.js
end
end
- 1
def edit
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@image = Image.find(params[:id])
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def update
- 1
@image = Image.find(params[:id])
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@image.update(image_params)
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def destroy
- 1
@image = Image.find(params[:id])
- 1
@image.destroy
end
- 1
def move
@daycare = Daycare.find(params[:daycare_id])
params['image'].each_with_index do |id, index|
image = Image.find(id)
image.update_attribute(:position, index+1) if image
end
render nothing: true
end
- 1
private
- 1
def image_params
- 4
params.require(:image).permit(:picture, :description)
end
end
- 1
class ProgramsController < ApplicationController
- 1
def create
- 1
@program = Program.new(program_params)
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@program.daycare = @daycare
- 1
@program.save
#create new program to display create program form so users can add more programs
- 1
@program = Program.new
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def edit
- 2
@daycare = Daycare.find(params[:daycare_id])
- 2
@program = Program.find(params[:id])
- 2
respond_to do |format|
- 2
format.html
- 2
format.js
end
end
- 1
def update
- 2
@program = Program.find(params[:id])
- 2
@daycare = Daycare.find(params[:daycare_id])
- 2
@program.update(program_params)
- 2
respond_to do |format|
- 2
format.html
- 2
format.js
end
end
- 1
def destroy
- 2
@program = Program.find(params[:id])
- 1
@program.destroy
end
- 1
def move
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
params['program'].each_with_index do |id, index|
- 2
program = Program.find(id)
- 2
program.update_attribute(:position, index+1) if program
end
- 1
render nothing: true
end
- 1
private
- 1
def program_params
- 3
params.require(:program).permit(:name, :description, :age_from, :age_from_units, :age_to, :age_to_units, :picture, :available, :id, :position)
end
end
- 1
class SummariesController < ApplicationController
- 1
def create
- 1
@summary = Summary.new(summary_params)
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@summary.daycare = @daycare
- 1
@summary.save
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def update
- 1
@summary = Summary.find(params[:id])
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@summary.update(summary_params)
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def destroy
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@summary = Summary.find(params[:id])
- 1
@summary.destroy
- 1
@summary = Summary.new
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
private
- 1
def summary_params
- 2
params.require(:summary).permit(:content)
end
end
- 1
class TeachersController < ApplicationController
- 1
def create
- 1
@teacher = Teacher.new(teacher_params)
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
@teacher.daycare = @daycare
- 1
@teacher.save
#create new teacher to display create teacher form so users can add more teachers
- 1
@teacher = Teacher.new
- 1
respond_to do |format|
- 1
format.html
- 1
format.js
end
end
- 1
def edit
- 2
@daycare = Daycare.find(params[:daycare_id])
- 2
@teacher = Teacher.find(params[:id])
- 2
respond_to do |format|
- 2
format.html
- 2
format.js
end
end
- 1
def update
- 2
@teacher = Teacher.find(params[:id])
- 2
@daycare = Daycare.find(params[:daycare_id])
- 2
@teacher.update(teacher_params)
- 2
respond_to do |format|
- 2
format.html
- 2
format.js
end
end
- 1
def destroy
- 2
@teacher = Teacher.find(params[:id])
- 1
@teacher.destroy
end
- 1
def move
- 1
@daycare = Daycare.find(params[:daycare_id])
- 1
params['teacher'].each_with_index do |id, index|
- 2
teacher = Teacher.find(id)
- 2
teacher.update_attribute(:position, index+1) if teacher
end
- 1
render nothing: true
end
- 1
private
- 1
def teacher_params
- 3
params.require(:teacher).permit(:name, :about, :picture, :id, :position)
end
end
- 1
class UsersController < ApplicationController
end
- 1
module AdditionalsHelper
end
- 1
module AddressesHelper
end
- 1
module ApplicationHelper
end
- 1
module CertificationsHelper
end
- 1
module ContactsHelper
end
- 1
module DaycaresHelper
end
- 1
module HomeHelper
end
- 1
module ImagesHelper
end
- 1
module ProgramsHelper
end
- 1
module SummariesHelper
end
- 1
module TeachersHelper
end
- 1
module UsersHelper
end
- 1
class Additional < ActiveRecord::Base
- 1
belongs_to :daycare
- 1
has_attached_file :image, styles: { medium: "300x300>", thumb: "150x150>" }, default_url: ":style/addtl.png"
- 1
validates :title, :presence => true
- 1
validates :content, :presence => true
- 1
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
# sets position attribute of new additional info
- 1
acts_as_list
end
- 1
class Address < ActiveRecord::Base
# attr_accessible :street, :city, :state, :zip, :latitude, :longitude
- 1
attr_reader :full_address
- 1
belongs_to :daycare
- 1
geocoded_by :full_address
- 1
after_validation :geocode
- 1
validates :street, :presence => true
- 1
validates :city, :presence => true
- 1
validates :state, :presence => true
- 1
validates :zip, :presence => true
- 1
def full_address
- 10
"#{street}, #{city}, #{state} #{zip}"
end
end
- 1
class Certification < ActiveRecord::Base
- 1
belongs_to :daycare
- 1
has_attached_file :image, styles: { small: "150x150>" }, default_url: ":style/cert.png"
- 1
validates :name, :presence => true
- 1
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
- 1
acts_as_list
end
- 1
class Contact < ActiveRecord::Base
- 1
belongs_to :daycare
- 1
validates :phone, :presence => true
- 1
validates :email, :presence => true
end
- 1
class Daycare < ActiveRecord::Base
- 1
belongs_to :user
- 1
has_many :images
- 1
has_one :contact
- 1
has_one :address
- 1
has_many :teachers
- 1
has_many :programs
- 1
has_one :summary
- 1
has_many :certifications
- 1
has_many :additionals
- 1
validates :name, :presence => true
end
- 1
class Image < ActiveRecord::Base
- 1
belongs_to :daycare
- 1
has_attached_file :picture, styles: { large: "1252x705", thumb: "150x150>" }, default_url: "/images/:style/missing.png"
- 1
validates_attachment_content_type :picture, content_type: /\Aimage\/.*\Z/
- 1
def image_url
picture.url(:thumb)
end
end
- 1
class Program < ActiveRecord::Base
- 1
belongs_to :daycare
- 1
has_attached_file :picture, styles: { small: "256x144>",medium: "512x288>" }, default_url: ":style/program.png"
- 1
validates :name, :presence => true
- 1
validates :description, :presence => true
- 1
validates_attachment_content_type :picture, content_type: /\Aimage\/.*\Z/
- 1
acts_as_list
end
- 1
class Summary < ActiveRecord::Base
- 1
belongs_to :daycare
- 1
validates :content, :presence => true
end
- 1
class Teacher < ActiveRecord::Base
- 1
belongs_to :daycare
- 1
has_attached_file :picture, styles: { medium: "200x200>", thumb: "150x150>" }, default_url: ":style/teacher.png"
- 1
validates :name, :presence => true
- 1
validates_attachment_content_type :picture, content_type: /\Aimage\/.*\Z/
# sets position attribute of new teachers
- 1
acts_as_list
end
- 1
class User < ActiveRecord::Base
- 1
attr_accessor :login
- 1
has_one :daycare
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
- 1
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:authentication_keys => [:login]
- 1
validates :user_name, :presence => true,
:uniqueness => {:case_sensitive => false} # etc.
- 1
validate :validate_username
#override find_for_database_authentication to user username
- 1
def self.find_for_database_authentication(warden_conditions)
- 4
conditions = warden_conditions.dup
- 4
if login = conditions.delete(:login)
- 4
where(conditions.to_hash).where(["lower(user_name) = :value OR lower(email) = :value", { :value => login.downcase }]).first
else
conditions[:email].downcase! if conditions[:email]
where(conditions.to_hash).first
end
end
- 1
def validate_username
- 41
if User.where(email: user_name).exists?
- 1
errors.add(:user_name, :invalid)
end
end
end
- 1
require File.expand_path('../boot', __FILE__)
- 1
require "rails"
# Pick the frameworks you want:
- 1
require "active_model/railtie"
- 1
require "active_job/railtie"
- 1
require "active_record/railtie"
- 1
require "action_controller/railtie"
- 1
require "action_mailer/railtie"
- 1
require "action_view/railtie"
- 1
require "sprockets/railtie"
# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
- 1
Bundler.require(*Rails.groups)
- 1
module DaycareHub
- 1
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Do not swallow errors in after_commit/after_rollback callbacks.
- 1
config.active_record.raise_in_transactional_callbacks = true
end
end
- 1
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
- 1
require 'bundler/setup' # Set up gems listed in the Gemfile.
# Load the Rails application.
- 1
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
- 1
Rails.application.initialize!
- 1
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
- 1
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
- 1
config.eager_load = false
# Configure static file server for tests with Cache-Control for performance.
- 1
config.serve_static_files = true
- 1
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
- 1
config.consider_all_requests_local = true
- 1
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
- 1
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
- 1
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
- 1
config.action_mailer.delivery_method = :test
# Randomize the order test cases are executed.
- 1
config.active_support.test_order = :random
# Print deprecation notices to the stderr.
- 1
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
- 1
config.action_dispatch.show_exceptions = true
end
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
- 1
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
- 1
Rails.application.config.assets.precompile += %w( /map/gmap.js )
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# Be sure to restart your server when you modify this file.
- 1
Rails.application.config.action_dispatch.cookies_serializer = :json
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
- 1
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`
# by default. You can change it below and use your own secret key.
# config.secret_key = '3aa91b2890efb50ffeaaecc2ff372bce6323108ad454412de904117011cffcae30afe786a97be08756f4067af7605f97ce4aa087a42fede15bc854932d88804f'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
- 1
config.mailer_sender =<EMAIL_ADDRESS># Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
- 1
require 'devise/orm/active_record'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
# config.authentication_keys = [:email]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
# find_for_authentication method and considered in your model lookup. For instance,
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
# The same considerations mentioned for authentication_keys also apply to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
- 1
config.case_insensitive_keys = [:email]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
- 1
config.strip_whitespace_keys = [:email]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
# given strategies, for example, `config.params_authenticatable = [:database]` will
# enable it only for database (email + password) authentication.
# config.params_authenticatable = true
# Tell if authentication through HTTP Auth is enabled. False by default.
# It can be set to an array that will enable http authentication only for the
# given strategies, for example, `config.http_authenticatable = [:database]` will
# enable it only for database authentication. The supported strategies are:
# :database = Support basic authentication with authentication key + password
# config.http_authenticatable = false
# If 401 status code should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication. 'Application' by default.
# config.http_authentication_realm = 'Application'
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# config.paranoid = true
# By default Devise will store the user in session. You can skip storage for
# particular strategies by setting this option.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing skip: :sessions to `devise_for` in your config/routes.rb
- 1
config.skip_session_storage = [:http_auth]
# By default, Devise cleans up the CSRF token on authentication to
# avoid CSRF token fixation attacks. This means that, when using AJAX
# requests for sign in and sign up, you need to get a new CSRF token
# from the server. You can disable this option at your own risk.
# config.clean_up_csrf_token_on_authentication = true
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
# using other encryptors, it sets how many times you want the password re-encrypted.
#
# Limiting the stretches to just one in testing will increase the performance of
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
# a value less than 10 in other environments. Note that, for bcrypt (the default
# encryptor), the cost increases exponentially with the number of stretches (e.g.
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
- 1
config.stretches = Rails.env.test? ? 1 : 10
# Setup a pepper to generate the encrypted password.
# config.pepper = '5e30a8535c2759696cb59942266255d0efec76a02d631aacc78ba4eeb2a654f9b1aec73b25f92de6f5debcf124f2a99c778838d9e039759574f47f6bf3417477'
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming their account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming their account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming their account.
# config.allow_unconfirmed_access_for = 2.days
# A period that the user is allowed to confirm their account before their
# token becomes invalid. For example, if set to 3.days, the user can confirm
# their account within 3 days after the mail was sent, but on the fourth day
# their account can't be confirmed with the token any more.
# Default is nil, meaning there is no restriction on how long a user can take
# before confirming their account.
# config.confirm_within = 3.days
# If true, requires any email changes to be confirmed (exactly the same way as
# initial account confirmation) to be applied. Requires additional unconfirmed_email
# db field (see migrations). Until confirmed, new email is stored in
# unconfirmed_email column, and copied to email column on successful confirmation.
- 1
config.reconfirmable = true
# Defines which key will be used when confirming an account
# config.confirmation_keys = [:email]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# Invalidates all the remember me tokens when the user signs out.
- 1
config.expire_all_remember_me_on_sign_out = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
# secure: true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
# Range for password length.
- 1
config.password_length = 8..72
# Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
# config.email_regexp = /\A[^@]+@[^@]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
# config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account
# config.unlock_keys = [:email]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
# config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
# config.maximum_attempts = 20
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
# Warn on the last attempt before the account is locked.
# config.last_attempt_warning = true
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
# config.reset_password_keys = [:email]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
- 1
config.reset_password_within = 6.hours
# When set to false, does not sign a user in automatically after their password is
# reset. Defaults to true, so a user is signed in automatically after a reset.
# config.sign_in_after_reset_password = true
# ==> Configuration for :encryptable
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
# REST_AUTH_SITE_KEY to pepper).
#
# Require the `devise-encryptable` gem when using anything other than bcrypt
# config.encryptor = :sha512
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user).
# config.default_scope = :user
# Set this configuration to false if you want /users/sign_out to sign out
# only the current scope. By default, Devise signs out all scopes.
# config.sign_out_all_scopes = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
#
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists.
#
# The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ['*/*', :html]
# The default HTTP method used to sign out a resource. Default is :delete.
- 1
config.sign_out_via = :delete
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
# is mountable, there are some extra configurations to be taken into account.
# The following options are available, assuming the engine is mounted as:
#
# mount MyEngine, at: '/my_engine'
#
# The router that invoked `devise_for`, in the example above, would be:
# config.router_name = :my_engine
#
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
- 1
config.authentication_keys = [ :login ]
- 1
config.scoped_views = true
- 1
config.reset_password_keys = [ :username ]
- 1
config.confirmation_keys = [ :username ]
- 1
config.secret_key = '30b636446b1616ec3a6e67867c79ef3832819e27ac9b7a4c1343f7aaa8af41333ab658bafe229574d527acaf50d11fc29bff2e3856dcf823d321e2bf866c2242'
end
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
- 1
Rails.application.config.filter_parameters += [:password]
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Be sure to restart your server when you modify this file.
- 1
Rails.application.config.session_store :cookie_store, key: '_daycare-hub_session'
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
- 1
ActiveSupport.on_load(:action_controller) do
- 1
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
- 1
Rails.application.routes.draw do
- 1
root 'home#index'
- 1
devise_for :users
- 1
resources :users do
- 1
resources :daycares
end
- 1
resources :daycares do
- 1
resources :images, only: [:create, :edit, :update, :destroy] do
- 2
collection { post :move }
end
end
- 1
resources :daycares do
- 1
resources :contacts
end
- 1
resources :daycares do
- 1
resources :summaries, only: [:create, :edit, :update, :destroy]
end
- 1
resources :daycares do
- 1
resources :addresses, only: [:create, :update, :show]
end
- 1
resources :daycares do
- 1
resources :programs, only: [:create, :edit, :update, :destroy] do
- 2
collection { post :move }
end
end
- 1
resources :daycares do
- 1
resources :certifications, only: [:create, :edit, :update, :destroy] do
- 2
collection { post :move }
end
end
- 1
resources :daycares do
- 1
resources :teachers, only: [:create, :edit, :update, :destroy] do
- 2
collection { post :move }
end
end
- 1
resources :daycares do
- 1
resources :additionals, only: [:create, :edit, :update, :destroy] do
- 2
collection { post :move }
end
end
- 1
get "/search-results", to: "home#show", as: "search_results"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
- 1
require 'rails_helper'
- 1
RSpec.describe AdditionalsController, type: :controller do
end
- 1
require 'rails_helper'
- 1
RSpec.describe AddressesController, type: :controller do
end
- 1
require 'rails_helper'
- 1
RSpec.describe CertificationsController, type: :controller do
end
- 1
require 'rails_helper'
- 1
RSpec.describe ContactsController, type: :controller do
end
- 1
require 'rails_helper'
- 1
RSpec.describe DaycaresController, type: :controller do
end
- 1
require 'rails_helper'
- 1
RSpec.describe HomeController, type: :controller do
- 1
describe "GET #index" do
- 1
it "returns http success" do
- 1
get :index
- 1
expect(response).to have_http_status(:success)
end
end
end
- 1
require 'rails_helper'
- 1
RSpec.describe ImagesController, type: :controller do
end
- 1
require 'rails_helper'
- 1
RSpec.describe ProgramsController, type: :controller do
end
- 1
require 'rails_helper'
- 1
RSpec.describe SummariesController, type: :controller do
end
- 1
require 'rails_helper'
- 1
RSpec.describe TeachersController, type: :controller do
end
- 1
require 'rails_helper'
- 1
RSpec.describe UsersController, type: :controller do
end
- 1
FactoryGirl.define do
- 1
factory :additional do
- 1
title "additional info"
- 1
content "additional content"
end
end
- 1
FactoryGirl.define do
- 1
factory :address do
- 1
street '1800 SW Farmington Rd'
- 1
city 'Aloha'
- 1
state 'OR'
- 1
zip '97007'
- 1
daycare
end
end
- 1
FactoryGirl.define do
- 1
factory :certification do
- 1
name 'cert name'
- 1
description 'cert description'
end
end
- 1
FactoryGirl.define do
- 1
factory :contact do
- 1
email<EMAIL_ADDRESS>- 1
phone '123-456-789'
end
end
- 1
FactoryGirl.define do
- 1
factory :daycare do
- 1
name 'My Daycare'
- 1
structure 'home'
- 1
user
end
end
- 1
FactoryGirl.define do
- 1
factory :image do
end
end
- 1
FactoryGirl.define do
- 1
factory :program do
- 1
name "Program"
- 1
description "Description"
end
end
- 1
FactoryGirl.define do
- 1
factory :summary do
- 1
content "daycare summary"
end
end
- 1
FactoryGirl.define do
- 1
factory :teacher do
- 1
name "Teacher"
- 1
about "About"
end
end
- 1
FactoryGirl.define do
- 1
factory :user do
- 1
email<EMAIL_ADDRESS>- 1
password 'password'
- 1
user_name 'testuser'
end
end
- 1
require 'rails_helper'
- 1
describe "the additional crud process" do
- 1
it "allows user to add additional information", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-additional'
- 1
fill_in "additional-edit-name", :with => 'New Info'
- 1
fill_in 'Content', :with => 'New Content'
- 1
click_button 'Create Additional'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'New Content'
end
- 1
it "allows the user to edit additional info", js:true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
additional = FactoryGirl.create(:additional)
- 1
daycare.additionals.push(additional)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-additional'
# click_on "additional-edit-#{additional.id}"
- 1
find("#additional-edit-#{additional.id}").trigger('click') #icon is on draggable panel header(overlapping elements)
- 1
fill_in "additional-edit-name#{additional.id}", :with => 'EditAdditional'
- 1
click_button 'Update Additional'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'EditAdditional'
end
- 1
it "allows the user to delete additional info", js:true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
additional = FactoryGirl.create(:additional)
- 1
daycare.additionals.push(additional)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-additional'
- 1
find("#additional-delete-#{additional.id}").trigger('click')
- 2
expect { find("#additional-delete-#{additional.id}").trigger('click') }.to change(Additional, :count).by(-1)
end
end
- 1
require 'rails_helper'
- 1
describe "the address crud process" do
- 1
it "allows user to add address information", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-address'
- 1
fill_in 'Street', :with => '1234 Address Dr'
- 1
fill_in 'City', :with => 'City'
# fill_in 'State', :with => 'OR'
- 1
fill_in 'Zip', :with => '12345'
- 1
click_button 'Create Address'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content '1234 Address Dr'
end
- 1
it "allows users to update address information", js:true do
- 1
address = FactoryGirl.create(:address)
- 1
daycare = address.daycare
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-address'
- 1
fill_in 'Street', :with => 'New Address Dr'
- 1
click_button 'Update Address'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'New Address Dr'
end
end
- 1
require 'rails_helper'
- 1
describe "the sign in process" do
- 1
it "signs up user with user name" do
- 1
visit new_user_registration_path
- 1
fill_in 'User name', :with => 'user'
- 1
fill_in 'Email', :with =><EMAIL_ADDRESS>- 1
fill_in 'Password', :with => 'password'
- 1
fill_in 'Password confirmation', :with => 'password'
- 1
click_button 'Sign up'
- 1
expect(page).to have_content 'user'
end
- 1
it "signs in user with user name" do
- 1
user = FactoryGirl.create(:user)
- 1
visit user_session_path
- 1
fill_in 'user_login', :with => 'testuser'
- 1
fill_in 'Password', :with => 'password'
- 1
click_button 'Log in'
- 1
expect(page).to have_content 'testuser'
end
- 1
it "returns error if user signs up with a user name of existing email" do
- 1
user = FactoryGirl.create(:user)
- 1
visit new_user_registration_path
- 1
fill_in 'User name', :with =><EMAIL_ADDRESS>- 1
fill_in 'Email', :with =><EMAIL_ADDRESS>- 1
fill_in 'Password', :with => 'password'
- 1
fill_in 'Password confirmation', :with => 'password'
- 1
click_button 'Sign up'
- 1
expect(page).to have_content 'User name is invalid'
end
- 1
it "directs users with no daycare to new daycare page on sign in" do
- 1
user = FactoryGirl.create(:user)
- 1
visit user_session_path
- 1
fill_in 'user_login', :with => 'testuser'
- 1
fill_in 'Password', :with => 'password'
- 1
click_button 'Log in'
- 1
expect(page).to have_content 'Add Daycare'
end
- 1
it "directs users with daycare to profile page on sign in" do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
visit user_session_path
- 1
fill_in 'user_login', :with => 'testuser'
- 1
fill_in 'Password', :with => 'password'
- 1
click_button 'Log in'
- 1
expect(page).to have_content 'My Daycare'
end
end
- 1
require 'rails_helper'
- 1
describe "the certification crud process" do
- 1
it "allows user to add certification", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-certification'
- 1
fill_in 'certification-edit-name', :with => 'New Cert'
- 1
fill_in 'certification-edit-desc', :with => 'Cert Description'
- 1
click_button 'Create Certification'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'New Cert'
end
- 1
it "allows the user to delete certification", js:true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
certification = FactoryGirl.create(:certification)
- 1
daycare.certifications.push(certification)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-certification'
- 1
find("#certification-delete-#{certification.id}").trigger('click')
- 2
expect { find("#certification-delete-#{certification.id}").trigger('click') }.to change(Certification, :count).by(-1)
end
end
- 1
require 'rails_helper'
- 1
describe "the contact crud process" do
- 1
it "allows user to add contact information", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-contact'
- 1
fill_in 'Email', :with =><EMAIL_ADDRESS>- 1
fill_in 'Phone', :with => '123-456-7890'
- 1
click_button 'Create Contact'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content<EMAIL_ADDRESS>end
- 1
it "allows users to update contact information", js:true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
contact = FactoryGirl.create(:contact)
- 1
user = daycare.user
- 1
daycare.contact = contact
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-contact'
- 1
fill_in 'Email', :with =><EMAIL_ADDRESS>- 1
click_button 'Update Contact'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content<EMAIL_ADDRESS>end
#using html to require fields (validation tested in model)
# it "allows users to update contact information", js:true do
# daycare = FactoryGirl.create(:daycare)
# contact = FactoryGirl.create(:contact)
# user = daycare.user
# daycare.contact = contact
# login_as(user, :scope => :user)
# visit edit_user_daycare_path(user, daycare)
# click_link 'daycare-edit-contact'
# fill_in 'Email', :with => ''
# click_button 'Update Contact'
# expect(page).to have_content 'Please fix these errors'
# end
end
- 1
require 'rails_helper'
- 1
describe "the daycare crud process" do
- 1
it "allows user to add daycare", js: true do
- 1
user = FactoryGirl.create(:user)
- 1
login_as(user, :scope => :user)
- 1
daycare = Daycare.new
- 1
visit new_user_daycare_path(user, daycare)
- 1
fill_in 'Name', :with => 'My Daycare'
- 1
click_button 'Create Daycare'
- 1
expect(page).to have_content 'My Daycare'
end
#using html to require fields (validation tested in model)
# it "displays errors with daycare save method" do
# user = FactoryGirl.create(:user)
# login_as(user, :scope => :user)
# daycare = Daycare.new
# visit new_user_daycare_path(user, daycare)
# fill_in 'Name', :with => ''
# click_button 'Create Daycare'
# expect(page).to have_content 'Please fix these errors'
# end
- 1
it "allows user to update daycare", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-name'
- 1
fill_in 'Name', :with => 'Updated Daycare'
- 1
click_button 'Update Daycare'
- 1
expect(page).to have_content 'Updated Daycare'
end
end
- 1
require 'rails_helper'
- 1
require 'spec_helper'
- 1
describe "Image crud process" do
- 1
it "allows user to add image to daycare", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-add-image'
- 1
fill_in 'image-edit-desc', :with => 'Photo Description'
- 1
find("#btn-select-image").trigger('click')
- 1
attach_file('image[picture]', 'spec/images/daycare.jpg')
- 1
sleep(2)
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'Photo Description'
end
- 1
it "allows user to delete image for daycare", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-add-image'
- 1
fill_in 'image-edit-desc', :with => 'Photo Description'
- 1
attach_file('image[picture]', 'spec/images/daycare.jpg')
- 1
sleep(2) #should add wait_for_ajax method here (this is not a good fix)
- 1
find("#image-delete-#{daycare.images.first.id}").trigger('click') #icon is on draggable panel header(overlapping elements)
- 1
expect(page).to_not have_content 'daycare.jpg'
end
- 1
it "allows user to update image for daycare", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-add-image'
- 1
fill_in 'image-edit-desc', :with => 'Photo Description'
- 1
attach_file('image[picture]', 'spec/images/daycare.jpg')
- 1
sleep(2)
- 1
image = daycare.images.first
- 1
find("#image-edit-#{image.id}").trigger('click') #icon is on draggable panel
- 1
fill_in "image-edit-desc#{image.id}", :with => 'Photo Edit'
- 1
click_button 'Update Image'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'Photo Edit'
end
end
- 1
require 'rails_helper'
- 1
describe "The navbar links" do
- 1
it "displays 'Add Daycare' link and user name if user with no daycare signs in" do
- 1
user = FactoryGirl.create(:user)
- 1
visit user_session_path
- 1
fill_in 'user_login', :with => 'testuser'
- 1
fill_in 'Password', :with => 'password'
- 1
click_button 'Log in'
- 1
expect(page).to have_content 'Add Daycare'
- 1
expect(page).to have_content 'testuser'
end
- 1
it "displays daycare name and edit, and view daycare links if user has daycare" do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit root_path
- 1
expect(page).to have_content 'My Daycare'
- 1
expect(page).to have_css "a#menu-view-daycare"
- 1
expect(page).to have_css "a#menu-edit-daycare"
- 1
expect(page).to_not have_content 'Add Daycare'
end
- 1
it "site name link navigates to home page" do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit user_daycare_path(user, daycare)
- 1
click_link 'beebsy'
- 1
expect(page).to have_content('Home')
end
- 1
it "home link navigates to home page" do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit user_daycare_path(user, daycare)
- 1
find('.dropdown').click
- 1
find('#menu-home').click
- 1
expect(page).to have_content('Home')
end
- 1
it "view daycare link navigates to daycare page" do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit user_daycare_path(user, daycare)
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_css("span.name", :text => "My Daycare")
end
- 1
it "edit daycare link navigates to edit daycare page" do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit user_daycare_path(user, daycare)
- 1
find('.dropdown').click
- 1
find('#menu-edit-daycare').click
- 1
expect(page).to have_css("span.daycare-edit-glyph")
end
- 1
it "sign out link signs user out" do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit user_daycare_path(user, daycare)
- 1
expect(page).to have_content('My Daycare')
- 1
find('.dropdown').click
- 1
find('#menu-signout').click
- 1
expect(page).to_not have_content('My Daycare')
end
end
- 1
require 'rails_helper'
- 1
describe "The program crud process" do
- 1
it "allows the user to add a program", js:true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-program'
- 1
fill_in 'program-edit-name', :with => 'TestProgram'
- 1
fill_in 'Description', :with => 'Description'
- 1
click_button 'Create Program'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'TestProgram'
end
- 1
it "allows the user to edit a program", js:true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
program = FactoryGirl.create(:program)
- 1
daycare.programs.push(program)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-program'
# click_on "program-edit-#{program.id}"
- 1
find("#program-edit-#{program.id}").trigger('click') #icon is on draggable panel header(overlapping elements)
- 1
fill_in "program-edit-name#{program.id}", :with => 'EditProgram'
- 1
click_button 'Update Program'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'EditProgram'
end
- 1
it "allows user to change order of programs listed", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
program = FactoryGirl.create(:program)
- 1
daycare.programs.push(program)
- 1
program2 = FactoryGirl.create(:program)
- 1
daycare.programs.push(program2)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-program'
- 1
find("#program-edit-#{program.id}").trigger('click')
- 1
fill_in "program-edit-name#{program.id}", :with => 'FirstProgram'
- 1
click_button 'Update Program'
- 1
source = page.find("#panel-name-program-#{program2.id}")
- 1
target = page.find("#panel-name-program-#{program.id}")
- 1
source.drag_to(target)
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'Programs Program Ages: to No openings Description FirstProgram Ages: to We have openings Descriptio'
end
- 1
it "allows the user to delete a program", js:true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
program = FactoryGirl.create(:program)
- 1
daycare.programs.push(program)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-program'
- 1
find("#program-delete-#{program.id}").trigger('click')
- 2
expect { find("#program-delete-#{program.id}").trigger('click') }.to change(Program, :count).by(-1)
end
end
- 1
require 'rails_helper'
- 1
describe "The daycare search process" do
- 1
it "displays daycares within range of specified address", js: true do
- 1
address = FactoryGirl.create(:address)
- 1
daycare = address.daycare
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-add-image'
- 1
fill_in 'image-edit-desc', :with => 'Photo Description'
- 1
attach_file('image[picture]', 'spec/images/daycare.jpg')
# click_button 'Add Image'
- 1
visit root_path
- 1
fill_in 'search-text-field', :with => '17683 SW Farmington Rd Aloha, OR 97007'
- 1
click_button 'Go!'
- 1
expect(page).to have_content 'My Daycare'
end
- 1
it "displays daycare search results with default image", js: true do
- 1
address = FactoryGirl.create(:address)
- 1
visit root_path
- 1
fill_in 'search-text-field', :with => '17683 SW Farmington Rd Aloha, OR 97007'
- 1
click_button 'Go!'
- 1
expect(page).to have_content 'My Daycare'
end
- 1
it "navigate to selected daycare", js: true do
- 1
address = FactoryGirl.create(:address)
- 1
visit root_path
- 1
fill_in 'search-text-field', :with => '17683 SW Farmington Rd Aloha, OR 97007'
- 1
click_button 'Go!'
- 1
click_link 'My Daycare'
- 1
expect(page).to have_content 'My Daycare'
end
end
- 1
require 'rails_helper'
- 1
describe "the summary crud process" do
- 1
it "allows user to add summary to daycare", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-summary'
- 1
fill_in 'summary_content', :with => 'Daycare summary'
- 1
click_button 'Create Summary'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'Daycare summary'
end
- 1
it "allows user to update summary on daycare", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
summary = FactoryGirl.create(:summary)
- 1
daycare.summary = summary
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-summary'
- 1
fill_in 'summary_content', :with => 'daycare update'
- 1
click_button 'Update Summary'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'daycare update'
end
- 1
it "allows user to delete summary on daycare", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
summary = FactoryGirl.create(:summary)
- 1
daycare.summary = summary
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-summary'
- 1
click_link 'Delete Summary'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to_not have_content 'daycare summary'
end
end
- 1
require 'rails_helper'
- 1
describe "The teacher crud process" do
- 1
it "allows the user to add a teacher", js:true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-teacher'
- 1
fill_in 'teacher-edit-name', :with => 'TestTeacher'
- 1
fill_in 'About', :with => 'About'
- 1
click_button 'Create Teacher'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'TestTeacher'
end
- 1
it "allows the user to edit a teacher", js:true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
teacher = FactoryGirl.create(:teacher)
- 1
daycare.teachers.push(teacher)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-teacher'
# click_on "teacher-edit-#{teacher.id}"
- 1
find("#teacher-edit-#{teacher.id}").trigger('click') #icon is on draggable panel header(overlapping elements)
- 1
fill_in "teacher-edit-name#{teacher.id}", :with => 'EditTeacher'
- 1
click_button 'Update Teacher'
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'EditTeacher'
end
- 1
it "allows user to change order of teachers listed", js: true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
teacher = FactoryGirl.create(:teacher)
- 1
daycare.teachers.push(teacher)
- 1
teacher2 = FactoryGirl.create(:teacher)
- 1
daycare.teachers.push(teacher2)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-teacher'
- 1
find("#teacher-edit-#{teacher.id}").trigger('click')
- 1
fill_in "teacher-edit-name#{teacher.id}", :with => 'FirstTeacher'
- 1
click_button 'Update Teacher'
- 1
source = page.find("#panel-name-teacher-#{teacher2.id}")
- 1
target = page.find("#panel-name-teacher-#{teacher.id}")
- 1
source.drag_to(target)
- 1
find('.dropdown').click
- 1
find('#menu-view-daycare').click
- 1
expect(page).to have_content 'Teacher About FirstTeacher'
end
- 1
it "allows the user to delete a teacher", js:true do
- 1
daycare = FactoryGirl.create(:daycare)
- 1
teacher = FactoryGirl.create(:teacher)
- 1
daycare.teachers.push(teacher)
- 1
user = daycare.user
- 1
login_as(user, :scope => :user)
- 1
visit edit_user_daycare_path(user, daycare)
- 1
click_link 'daycare-edit-teacher'
- 1
find("#teacher-delete-#{teacher.id}").trigger('click')
- 2
expect { find("#teacher-delete-#{teacher.id}").trigger('click') }.to change(Teacher, :count).by(-1)
end
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the AdditionalsHelper. For example:
#
# describe AdditionalsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe AdditionalsHelper, type: :helper do
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the AddressesHelper. For example:
#
# describe AddressesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe AddressesHelper, type: :helper do
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the CertificationsHelper. For example:
#
# describe CertificationsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe CertificationsHelper, type: :helper do
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the ContactsHelper. For example:
#
# describe ContactsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe ContactsHelper, type: :helper do
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the DaycaresHelper. For example:
#
# describe DaycaresHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe DaycaresHelper, type: :helper do
# pending "add some examples to (or delete) #{__FILE__}"
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the HomeHelper. For example:
#
# describe HomeHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe HomeHelper, type: :helper do
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the ImagesHelper. For example:
#
# describe ImagesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe ImagesHelper, type: :helper do
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the ProgramsHelper. For example:
#
# describe ProgramsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe ProgramsHelper, type: :helper do
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the SummariesHelper. For example:
#
# describe SummariesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe SummariesHelper, type: :helper do
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the TeachersHelper. For example:
#
# describe TeachersHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe TeachersHelper, type: :helper do
end
- 1
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the UsersHelper. For example:
#
# describe UsersHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
- 1
RSpec.describe UsersHelper, type: :helper do
end
- 1
require 'rails_helper'
- 1
RSpec.describe Additional, type: :model do
- 2
it { should belong_to :daycare }
- 2
it { should validate_presence_of :title }
- 2
it { should validate_presence_of :content }
end
- 1
require 'rails_helper'
- 1
RSpec.describe Address, type: :model do
- 2
it { should belong_to :daycare }
- 2
it { should validate_presence_of :street }
- 2
it { should validate_presence_of :city }
- 2
it { should validate_presence_of :state }
- 2
it { should validate_presence_of :zip }
end
- 1
require 'rails_helper'
- 1
RSpec.describe Certification, type: :model do
- 2
it { should belong_to :daycare }
- 2
it { should validate_presence_of :name }
end
- 1
require 'rails_helper'
- 1
RSpec.describe Contact, type: :model do
- 2
it { should belong_to :daycare }
- 2
it { should validate_presence_of :phone }
- 2
it { should validate_presence_of :email }
end
- 1
require 'rails_helper'
- 1
RSpec.describe Daycare, type: :model do
- 2
it { should belong_to :user }
- 2
it { should have_many :images }
- 2
it { should have_one :contact }
- 2
it { should have_one :address }
- 2
it { should have_many :programs }
- 2
it { should have_many :teachers }
- 2
it { should have_many :certifications }
- 2
it { should have_one :summary }
- 2
it { should have_many :additionals }
- 2
it { should validate_presence_of :name }
end
- 1
require 'rails_helper'
- 1
RSpec.describe Image, type: :model do
- 2
it { should belong_to :daycare }
end
- 1
require 'rails_helper'
- 1
RSpec.describe Program, type: :model do
- 2
it { should belong_to :daycare }
- 2
it { should validate_presence_of :name }
- 2
it { should validate_presence_of :description }
end
- 1
require 'rails_helper'
- 1
RSpec.describe Summary, type: :model do
- 2
it { should belong_to :daycare }
- 2
it { should validate_presence_of :content }
end
- 1
require 'rails_helper'
- 1
RSpec.describe Teacher, type: :model do
- 2
it { should belong_to :daycare }
- 2
it { should validate_presence_of :name }
end
- 1
require 'rails_helper'
- 1
RSpec.describe User, type: :model do
- 2
it {should have_one :daycare}
end
# This file is copied to spec/ when you run 'rails generate rspec:install'
- 1
ENV['RAILS_ENV'] ||= 'test'
- 1
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
- 1
abort("The Rails environment is running in production mode!") if Rails.env.production?
- 1
require 'spec_helper'
- 1
require 'rspec/rails'
- 1
require 'capybara/rails'
- 1
require 'capybara/poltergeist'
- 1
Capybara.javascript_driver = :poltergeist
- 1
options = {js_errors: false}
- 1
Capybara.register_driver :poltergeist do |app|
# Capybara::Poltergeist::Driver.new(app, options)
end
- 1
require 'phantomjs' # <-- Not required if your app does Bundler.require automatically (e.g. when using Rails)
- 1
Capybara.register_driver :poltergeist do |app|
- 1
Capybara::Poltergeist::Driver.new(app, :phantomjs => Phantomjs.path)
end
# Add additional requires below this line. Rails is not loaded until this point!
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
#
# The following line is provided for convenience purposes. It has the downside
# of increasing the boot-up time by auto-requiring all files in the support
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
- 1
ActiveRecord::Migration.maintain_test_schema!
- 1
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
- 1
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
# config.use_transactional_fixtures = true
- 1
config.before(:suite) do
- 1
DatabaseCleaner.strategy = :truncation
end
- 1
config.around(:each) do |example|
- 73
DatabaseCleaner.cleaning do
- 73
example.run
end
end
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
- 1
config.infer_spec_type_from_file_location!
- 1
config.include Warden::Test::Helpers
- 1
config.before :suite do
- 1
Warden.test_mode!
end
end
- 1
Shoulda::Matchers.configure do |config|
- 1
config.integrate do |with|
- 1
with.test_framework :rspec
- 1
with.library :rails
end
end
- 1
require 'rails_helper'
- 1
RSpec.describe "home/index.html.erb", type: :view do
end


Your username and password didn't match. Please try again.
{% endif %}{% extends "base.html" %} {% load staticfiles %} {% block head %} {% endblock %} {% block body_attributes %}class="login"{% endblock %} {% block body %}
Your username and password didn't match. Please try again.
{% endif %}


Tutorial Task 1 Step 3: Submitting edits
In this step, you will learn how to:
• Check form default parameter values
• Create a request from a form
• Override the default parameter values in a request
• Submit a form and get a response
We now have a form which can generate POST requests to define the betting pool. Our next step will be to build
the code which handles these requests. We will start by simply recording changes, and defer validation until the
administrator attempts to open the pool. For our demonstration application, we will use in-memory persistence only, and
will provide ourselves with a way to clear it so that each JUnit
test can run independantly.
The first thing we want to test and implement is the display of the current state of the pool. We will do this by setting the state directly, using the supplied entity classes and then invoke the form to display the pool. At this time, we will also add the set up code to clear the pool before each test:
public void setUp() throws Exception { BettingPool.reset(); } public void testPoolDisplay() throws Exception { BettingPool.getGames()[0].setAwayTeam( "New York Jets" ); // (1) set up data BettingPool.getGames()[0].setHomeTeam( "Philadelphia Eagles" ); BettingPool.getGames()[2].setAwayTeam( "St. Louis Rams" ); BettingPool.getGames()[2].setHomeTeam( "Chicago Bears" ); BettingPool.setTieBreakerIndex(2); ServletRunner sr = new ServletRunner( "web.xml" ); ServletUnitClient client = sr.newClient(); client.setAuthorization( "aUser", "pool-admin" ); WebResponse response = client.getResponse( "http://localhost/PoolEditor" ); WebForm form = response.getFormWithID( "pool" ); assertNotNull( "No form found with ID 'pool'", form ); assertEquals( "Away team 0", "New York Jets", form.getParameterValue( "away0" ) ); // (2) check team names assertEquals( "Home team 0", "Philadelphia Eagles", form.getParameterValue( "home0" ) ); assertEquals( "Away team 1", "", form.getParameterValue( "away1" ) ); assertEquals( "Home team 1", "", form.getParameterValue( "home1" ) ); assertEquals( "Away team 2", "St. Louis Rams", form.getParameterValue( "away2" ) ); assertEquals( "Home team 2", "Chicago Bears", form.getParameterValue( "home2" ) ); assertEquals( "Tie breaker game", "2", form.getParameterValue( "tiebreaker" ) ); // (3) check radio button }
Here we are:
WebForm.getParameterValue
for each parameter, no matter its type.As before, the above test should initially fail. We then make it work by changing the loop in printBody
as follows:
BettingPoolGame[] games = BettingPool.getGames(); for (int i = 0; i < games.length; i++) { pw.println( "
<input name='home" + i + "' value='" + games[i].getHomeTeam() + "' >	" ); pw.println( "<input name='away" + i + "' value='" + games[i].getAwayTeam() + "'>	" ); pw.print( "<input type='radio' name='tiebreaker' value='" + i + "'" ); if (i == BettingPool.getTieBreakerIndex()) pw.print( " checked" ); pw.println( " />
" ); }
Now that we know we can display the current state of the pool, we will verify that we can use the form to change it as well:
public void testPoolEntry() throws Exception { ServletRunner sr = new ServletRunner( "web.xml" ); ServletUnitClient client = sr.newClient(); client.setAuthorization( "aUser", "pool-admin" ); WebResponse response = client.getResponse( "http://localhost/PoolEditor" ); WebForm form = response.getFormWithID( "pool" ); assertNotNull( "No form found with ID 'pool'", form ); form.setParameter( "away1", "Detroit Lions" ); // (1) enter values into the form form.setParameter( "home1", "Denver Broncos" ); form.setParameter( "tiebreaker", "1" ); SubmitButton saveButton = form.getSubmitButton( "save", "Save" ); // (2) select the desired submit button response = form.submit( saveButton ); // (3) submit the form assertEquals( "Away team 0", "", form.getParameterValue( "away0" ) ); // (4) verify the response assertEquals( "Home team 0", "", form.getParameterValue( "home0" ) ); assertEquals( "Away team 1", "Detroit Lions", form.getParameterValue( "away1" ) ); assertEquals( "Home team 1", "Denver Broncos", form.getParameterValue( "home1" ) ); assertEquals( "Tie breaker game", "1", form.getParameterValue( "tiebreaker" ) ); }
This is our first form submission. Take note:
This test will fail with a 405 response, since we have not defined a handler for the POST message. We do so now:
protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { updateBettingPool( request ); response.setContentType( "text/html" ); PrintWriter pw = response.getWriter(); pw.println( "" ); printBody( pw ); pw.println( "" ); } void updateBettingPool( HttpServletRequest request ) { BettingPoolGame[] games = BettingPool.getGames(); for (int i = 0; i < games.length; i++) { games[i].setAwayTeam( request.getParameter( "away" + i ) ); games[i].setHomeTeam( request.getParameter( "home" + i ) ); } BettingPool.setTieBreakerIndex( getTieBreakerIndex( request ) ); } private int getTieBreakerIndex( HttpServletRequest request ) { try { return Integer.parseInt( request.getParameter( "tiebreaker" ) ); } catch (NumberFormatException e) { return 0; } }
Note that we are using the same printBody
method as the doGet
method does.
We now have the ability to edit the pool entries. Our next step is to add the validation and handle opening the pool to bettors.


A freelancer
I'm a freelancer based in Aligarh, Uttar Pradesh, India. I have passion and love for web designing / development. Also I love to play and stream games too.
I create web sites, make them work and keeping them simple, to convey the message the way you want.
I'm also a photographer and editor. So if you want to have some good photos of yours or want to get some photos edited, ping me!


Hi, I am a PhD Candidate at University of Chinese Academy of Sciences and ShanghaiTech University, China. I am supervised by Prof. Jingyi Yu, affiliated with Virtual Reality and Visual Computing Center(VRVC). Prior to that, I was supervised by Prof. Youyi Zheng for two years, about computer graphics research.
PhD in Computer Science, 2018 - present
ShanghaiTech University
Master in Computer Science, 2016 - 2018
ShanghaiTech University
BSc in Communication Engineering, 2012 - 2016
Shandong University


GENERAL ASTROPHYSICS (V.S.Beskin)
|
- Introduction
- Observable ranges
- Earth-based and space observatories
- Distance and time in astronomy
- Basic unsolved problems (nature of dark matter, sources of g-bursts )
- Solar system
- Planets and satellites
- Elements of orbit (synodic, sidereal, draconic and anomalistic periods)
- Planetary magnethospheres
- Saturn rings and asteroids
- Saros
- The Sun
- Atmosphere and photosphere
- Lines, origin of broadening, growth curve
- Transport equation, darkening towards the edge
- Corona, active regions
- Stars
- Spectral grading
- Magnitudes
- Hertzprung-Russel diagram
- Chemical composition
- Evolution
- Double stars
- Visually and spectrally double systems
- Elements of orbit, mass function
- Pulsar PSR 1913+16 and gravitational radiation
- Galactic black hole candidates
- Inner structure of stars
- Stars of the main sequence
- Giants
- White dwarfs , Chandrasekhar limit
- Neutron stars
- Compact objects
- Radiopulsars:
- magnetosphere structure
- braking mechanism
- hollow cone model
- X-ray pulsars:
- magnetosphere structure
- accretion disks
- Non-stationary processes
- Cepheids and oscillatory instability of stars
- Novae
- Supernovae
- Diffuse matter
- Interstellar dust
- Gaseous component
- HI and HII regions
- Maser sources
- Molecular clouds
- Cosmic rays
- Galaxies
- Grading
- Evolution
- Structure
- Active galactic cores
- Quasars, radiogalaxies, BL Lac.
- Unified model
- Cosmology
- Jeans instability
- Clusters and superclusters
- Inflation model
- LITERATURE:
- D.Ya. Martynov. General Astrophysics
- V.M. Lipunov. Astrophysics of Neutron Stars
- S. Shapiro, S. Teukolsky. Black holes, white dwarfs and neutron stars
- I.S. Shklovsky. Stars
|
|


Using data can lead to more impactful decision making over intuition alone. But collecting, analyzing, and visualizing data is difficult, especially in resource constrained settings. The Disease Surveillance and Risk Monitoring (DiSARM) project, which ran from 2015-2020, built tools to help disease control programs use data to target interventions spatially, guide field teams more precisely, and evaluate coverage more robustly. A key aspect of the DiSARM project was the development of algorithms that can help distill data into actionable intelligence. These algorithms can be integrated into applications such as the DiSARM application or can be accessed through an application programming interface (API).
While the project has now closed, information about the project, including algorithm and software code, remains open-source. Links to the relevant GitHub repositories are contained on the documentation site.
The DiSARM project was led by the Malaria Elimination Initiative at the University of California San Francisco in collaboration with Peoplesized and the Clinton Health Access Initiative. The project was supported by the Bill & Melinda Gates Foundation, Task Force for Global Health, and Google.


Login
E-Mail Address
Email is invalid
Password
Forgot Password?
Password is required
Remeber Me
Don't have an account?
Create One
Login


tmux
There are a number of reasons why accessing a remote machine is invaluable to any scientists working with large datasets. In the early history of computing, working on a remote machine was standard practice - computers were bulky and expensive. Today we work on laptops that are more powerful than the sum of the world’s computing capacity 20 years ago, but many analyses (especially in genomics) won’t work on these laptops and must be run on remote machines.
You’ll know you need to start working on the cloud when…
The cloud is a part of our everyday life (e.g. using Amazon, Google, Netflix, or an ATM involves remote computing). The topic is fascinating but this lesson says ‘5 minutes or less’ so let’s get connected.
This is the first and last place in these lessons where it will matter if you are using PC, Mac, or Linux. After we connect, we will all be on the same operating system/computing environment.
To save time, your instructor will have launched an remote computer (instance) for you prior to the workshop. If you are following these lessons on your own, or after the workshop see the lesson on launching cloud instances on your own for instructions on how to do this yourself.
User Credentials Credentials are case sensitive:
Prerequisites: You must have an SSH client. There are several free options and we will use PuTTY [Download Putty.exe]

Prerequisites: Mac and Linux operating systems will already have terminals installed. Simply search for ‘Terminal’ and/or look for the terminal icon.
open the terminal and type the following command substituting ‘ip_address’ for the ip address your instructor will provide (or the ip address of an instance you have provisioned yourself). Be sure to pay attention to capitalization and spaces
$ ssh dcuser@ip_address
You will receive a security message that looks something like the message below. Type ‘yes’ to proceed.
The authenticity of host 'ec2-52-91-14-206.compute-1.amazonaws.com (<IP_ADDRESS>)' can't be established. ECDSA key fingerprint is SHA256:S2mMV8mCThjJHm0sUmK2iOE5DBqs8HiJr6pL3x/XxkI. Are you sure you want to continue connecting (yes/no)?
VNC - Virtual Network Computing is a technology that allows you to connect to and share the desktop of a remote computer. To use VNC the computer you are connecting to must be running a VNC server. To view the desktop, you will need to download a VNC viewing client such as RealVNCs VNC Viewer.
$ vncstart

When you connect, it is typical to receive a welcome screen. The Data Carpentry Amazon instances display this message upon connecting:
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-48-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Sun Jan 24 21:38:35 UTC 2016
System load: 0.0 Processes: 151
Usage of /: 48.4% of 98.30GB Users logged in: 0
Memory usage: 6% IP address for eth0: <IP_ADDRESS>
Swap usage: 0%
Graph this data and manage this system at:
https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
12 packages can be updated.
10 updates are security updates.
Last login: Sun Jan 24 21:38:36 2016 from
You should also have a blinking cursor awaiting your command
dcuser@ip-172-31-62-209 ~ $
Now that we have connected we can move on to the Unix shell lesson. There are however a few commands that tell you a little about the machine you have connected to:
whoami
- shows your username on computer you have connected to:dcuser@ip-172-31-62-209 ~ $ whoami
dcuser
df -h
- shows space on hard drive*dcuser@ip-172-31-62-209 ~ $ df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 12K 2.0G 1% /dev
tmpfs 396M 792K 395M 1% /run
/dev/xvda1 99G 48G 47G 51% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 144K 2.0G 1% /run/shm
none 100M 36K 100M 1% /run/user
* Under the column ‘Mounted on’ row that has ‘/’ as the value shows the value for the main disk.
cat /proc/cpuinfo
- shows detail information on how many processors (CPUs) the machine hasdcuser@ip-172-31-62-209 ~ $ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x415
cpu MHz : 2494.060
cache size : 25600 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase smep erms
bogomips : 4988.12
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x415
cpu MHz : 2494.060
cache size : 25600 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase smep erms
bogomips : 4988.12
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
tree -L 1
- shows a tree view of the file system 1 level below your current location.dcuser@ip-172-31-62-209 ~ $ tree -L 1
├── dc_sample_data
├── Desktop
├── Downloads
├── FastQC
├── openrefine-2.6-beta.1
├── R
└── Trimmomatic-0.32
7 directories, 0 files
Depending on how you connect to the cloud, you may have processes and jobs that are running, and will need to continue running for sometime. If you have collected to your cloud desktop via VNC, jobs you start will continue to run.  There are a few ways to keep cloud processes running in the background. Many times when we refer to a background process we are talking about what is described at this tutorial - running a command and returning to shell prompt. Here we describe a program that will allow us to run our entire shell and keep that process running even if we disconnect: tmux
.
tmux
sessionsStarting a new session
A ‘session’ can be thought of as a window for tmux
, you might open an terminal to do one thing on the a computer and then open a new terminal to work on another task at the command line. You can start a session and give it a descriptive name:
$ tmux new -s session_name
This creates a session with the name ‘session_name’
As you work, this session will stay active until you close this session. Even if you disconnect from your machine, the jobs you start in this session will run till completion.
Seeing active sessions
If you disconnect from your session, or from your ssh into a machine, you will need to reconnect to an existing tmux
session. You can see a list of existing sessions:
$ tmux list-sessions
Connecting to a session
To connect to an existing session:
$ tmux attach -t session_name
# -t option = 'target'
Switch sessions You can switch between sessions:
$ tmux switch -t session_name
Kill a session You can end sessions:
$ tmux kill-session -t session_name
Cloud computing offerings:
Learn more about cloud computing in bioinformatics
Fusaro VA, Patil P, Gafni E, Wall DP, Tonellato PJ (2011) Biomedical Cloud Computing With Amazon Web Services. PLoS Comput Biol 7(8): e1002147. doi: 10.1371/journal.pcbi.1002147


R | 1h 39min | Drama | 3 March 2004 (Australia)
Johnny is a successful banker who lives happily in a San Francisco townhouse with his fiancée, Lisa. One day, inexplicably, she gets bored with him and decides to seduce his best friend, Mark. From there, nothing will be the same again.
Director: Tommy Wiseau Writer: Tommy Wiseau Stars: Tommy Wiseau, Juliette Danielle, Greg Sestero, Philip Haldiman, Carolyn Minnott
Come see the Midnight Movie phenomenon that sells out screenings around the globe with a special screening of Tommy Wiseau’s The Room® in all its spectacularly insane glory! Find an upcoming event near you!
Director and Star
European-American actor and filmmaker, best known for writing, producing, directing, and starring in the 2003 film The Room.
Star
American actress best known for her starring role in the 2003 film The Room.
Star
American actor, writer, filmmaker, and model best known for his role as Mark in the 2003 cult film The Room.
Music
Bosnian-American composer of experimental music, sound installation, and film music.
The Room is the cult film of all time. But the audience participation is what made it a classic. I love this film it is one of my all time favorites. You either like The Room or you don't. Well, worth watching again and again. Johnny: "You are tearing me apart Lisa."
I have now seen Mr. Tommy Wiseau’s cinematic tour-de-force, "The Room" three times. With each viewing, "The Room" becomes more complexly entangled in and inseparable from my own life. I no longer know where The Room ends and I begin.
It is, without question, the worst film ever made. Including movies made on beta max video cameras in special education high school classes. But, this comment is in no way meant to be discouraging. Because while The Room is the worst movie ever made it is also the greatest way to spend a blisteringly fast 100 minutes in the dark.
This new film by producer Tommy Wiseau, demands that you have a sense of humor. This black comedy includes the best cinematography of San Francisco since Hitchcock's Vertigo. Wiseau, a new and mysterious presence on the Hollywood film making scene, produced and stars as the lead in the roller coaster ride of emotions which tun the gamut from hysterical laughter to gut wrenching guilt.


--- layout: post title: A New Generation of Belair and Duprey Kids... categories: [] tags: - family status: publish type: post published: true meta: _original_post_id: '' _original_import_author: John Duprey author: ---


--- title: resources permalink: "/resources" layout: default ---
This guide should give you sufficient information about the OpenStreetMap platform so that you can incorporate it into your classroom. But once you and your students are comfortable using the platform, you will want to branch out and do more. This includes more advanced mapping topics, utilities for data quality, and pointers to the wider OpenStreetMap community.
"Meet Your Mapper (MYM) tells you who has mapped in your area, when, and how much. Use it for fun, curiosity, or to help you make a list of people to invite to a mapping party or some other OSM event."
{{resource.description}}


Tools for model specification in the latent variable framework (add-on to the 'lava' package). The package contains three main functionalities: Wald tests/F-tests with improved control of the type 1 error in small samples, adjustment for multiple comparisons when searching for local dependencies, and adjustment for multiple comparisons when doing inference for multiple latent variable models.
| Version: | 1.4.1 |
| Depends: | R (≥ 2.10), lava, ggplot2 |
| Imports: | doParallel, MASS, Matrix, methods, multcomp, mvtnorm, nlme, parallel, reshape2, sandwich, stats, utils |
| Suggests: | clubSandwich, data.table, foreach, lava.tobit, lme4, lmerTest, numDeriv, pbapply, pbkrtest, R.rsp, riskRegression, survival, testthat |
| Published: | 2018-11-20 |
| Author: | Brice Ozenne [aut, cre] |
| Maintainer: | Brice Ozenne <brice.ozenne at orange.fr> |
| BugReports: | https://github.com/bozenne/lavaSearch2/issues |
| License: | GPL-3 |
| URL: | https://github.com/bozenne/lavaSearch2 |
| NeedsCompilation: | no |
| Materials: | NEWS |
| CRAN checks: | lavaSearch2 results |
| Reference manual: | lavaSearch2.pdf |
| Vignettes: |
overview |
| Package source: | lavaSearch2_1.4.1.tar.gz |
| Windows binaries: | r-devel: lavaSearch2_1.4.1.zip, r-release: lavaSearch2_1.4.1.zip, r-oldrel: lavaSearch2_1.4.1.zip |
| OS X binaries: | r-release: lavaSearch2_1.4.1.tgz, r-oldrel: lavaSearch2_1.4.1.tgz |
| Old sources: | lavaSearch2 archive |
Please use the canonical form https://CRAN.R-project.org/package=lavaSearch2 to link to this page.


Shatta Wale celebrates his London daughter’s birthday with pretty photos
by RASHADIt’s no secret that Shatta Wale, the Dancehall King has 3 children with 3 different women we know so far.
He has two girls and one boy. Currently, his last born, Majesty lives with her mother, Michy right here in Ghana.
The second child, Cherissa lives in the USA with her mother and the firstborn who has well been hidden is based in London with her mother.
Shatta Wale for the first time has shared a photo of a young lady as his daughter based in London. He shared the photo to celebrate her as she observed her birthday yesterday.
The young girl is called Ohemaa Faye and she is exceedingly beautiful by every standard. She is slim and well parked for such a young lady
Interestingly, the young girl Shatta Wale is celebrating as his daughter is far older than what we know his daughter in London to be. Shatta in an interview confessed she is 9 years old.
SEE ALSO: Social media madness: Video of a bride arriving at her wedding in a coffin goes viral (Watch)
Well, it could be Shatta Wale lied and she is older or she is not his biological daughter as he wants us to believe; One of those ladies she is mentoring as their daddy.
Sharing the news on his Instagram page, Shatta Wale posted:
Happy birthday to my sweetest dawta in London @ohemaafaye ,Remember daddy loves you so much and can’t wait to see become that great Lawyer ???????
Check out more photos of Ohemaa Faye below
SEE ALSO: Big b00ty model, Sanchi goes raw – Releases new sizzling hot bedroom photos to tease fans (See)
GhPage.com wishes her a happy belated birthday


Practical Desurvey
created: 2019-06-27 modified: 2020-12-15Introduction
Desurvey is the practice of obtaining the geometry of a drillhole through its deviation survey data.
Here we present two methods: tangent and spherical arc.
Definitions
Considering a right-handed coordinate system, with \(x\) pointing east, \(y\) north and \(z\) up,- \(x_i\) — the spatial location vector of each survey point, being \(x_0\) given as the collar of the drillhole.
- \(v_i\) — the plunge vector of the drillhole at the survey points. It is usually calculated from the measured trend \(\theta\) and plunge \(\phi\), with positive plunge downwards: $$ v_i = \begin{bmatrix} \sin(\theta)\cos(\phi)\\ \cos(\theta)\cos(\phi)\\ -\sin(\phi)\\ \end{bmatrix} $$
- \(a_i\) — the position along the drillhole on where each survey was made.
- \(s_i\) — the length of the segment between each \(i\) and \(i+1\) survey points, that is, $$s_i = a_{i+1} - a_i$$
Tangent
The simplest method is to consider the drillhole a sequence of straight segments with the same down-hole orientation as the last survey point. For that, we simply accumulate \(s_i v_i\) from \(x_0\) to obtain each \(x_{i+1}\) in sequence: $$ x_{i+1} = x_0 + \sum_{j=0}^{i} s_j v_j $$
To obtain the coordinates of an arbitrary point \(p\) at position \(d\) along the drillhole find \(i\) such that \(a_{i+1} > d\), then $$ p = x_i + (d - a_i) v_i \label{tangent}\tag{1} $$
Spherical arc
The spherical arc method, also known as minimum curvature, treats each segment of the drillhole as a great circle arc with length \(s_i\) that encompass the angle1 \(\alpha_i\) between each survey point \(i\) and its successor \(i+1\). Being \(\alpha\) in radians, the radius \(r_i\) of the sphere can be calculated as $$ r_i = {s_i \over \alpha_i} $$
To obtain the center \(c_i\) of the sphere, we must offset \(x_i\) a distance \(r_i\) perpendicular to \(v_i\) on the plane spanning \(v_i\) and \(v_{i+1}\). The normal \(n_i\) to this plane is obtained through $$ n_i = {{v_i \times v_{i+1}} \over {|v_i \times v_{i+1}|}} $$
from this, the vector \(q_i\) perpendicular to \(v_i\) is simply $$ q_i = n_i \times v_i $$
being the center then $$ c_i = x_i + r n_i \times v_i. $$
Using \(v_i\) and \(q_i\) as an orthogonal pair spanning the plane, the position of the next survey point \(x_{i+1}\) is built as $$ x_{i+1} = c_i - r q_i cos (\alpha_i) + r v_i sin (\alpha_i) \label{sphere_survey}\tag{2} $$
Similarly, an arbitrary point \(p\) at position \(d\) along the drillhole is found using \(i\) such that \(a_{i+1} > d\). Its angular position \(\theta\) along the great circle is $$ \theta = {{d - a_i} \over r_i} $$
This angle can be plugged into equation \(\ref{sphere_survey}\) instead of \(\alpha\) so that we get $$ p = c_i - r q_i cos (\theta) + r v_i sin (\theta) \label{sphere}\tag{3} $$
Interactive Example
Collar
Survey
Lith
Options
1. Always check if the angle between two consecutive survey points is not zero or near zero; if so, use the tangent method for the segment instead of spherical arc, as the numerical precision might blow up and give you bad results.
On the subject of angles, you can either use the arccosine of the dot product or the arctangent of the magnitude of the cross product over the dot product. The second method is much more precise for small angles and will allow you to use a closer tolerance before considering that the angle between two survey points is zero. It's costlier in terms of processing, though. ↩
References
- The dark art of drillhole desurveying, from the leapfrog3d blog (internet archive)
- Drillhole De-Surveying, from Steve Henley's blog (internet archive)


STL Slicer for 3D Printed Microfluidics
mm per STL units:
Layer height (μm):
Your browser doesn't appear to support the
<canvas>
element.


{% extends 'accounts/layout.html' %} {% block content %}
You're all set. Your new password has been set!
Invalid or Expired Link! Please click here to try again.


TRIANGLE TRACKER
side a
side b
side c
EQUILATERAL
has all sides equal
ISCOCELES
Two of the sides haves same length
SCALENE
All the sides are different
CLICK THE BUTTON ABOVE TO KEY IN THE DIMENSION OF YOUR CHOICE AND SEE THE RESULTS
Lets do this


ExMatrix.Generators
ExMatrix.Generators provides functions for creating matrices and parts of matrices
Examples
# Generate a filled row with one cell set
ExMatrix.Generators.generate_filled_row(5, 1, 3) == [0, 0, 1, 0, 0]
# Generate a zero filled row
ExMatrix.Generators.generate_zero_row(4) == [0, 0, 0, 0]
Summary↑
| generate_filled_row(columns, value, col) | Generates a row of |
| generate_partial_matrix(value, row, column, cells) | Generates a matrix of |
| generate_zero_row(columns) | Generates a zero filled row of |
Functions
Generates a row of columns
length which is zero filled apart from the element at position col
which will have the value value
.
iex> ExMatrix.Generators.generate_filled_row(5, 1, 3)
[0, 0, 1, 0, 0]
Generates a matrix of cells
size settings every cell to 0 except for the cell at row, column
which will be set to value
iex> ExMatrix.Generators.generate_partial_matrix(100, 1, 1, 10)
[[100, 0, 0], [0, 0, 0], [0, 0, 0]]
Generates a zero filled row of columns
length
iex> ExMatrix.Generators.generate_zero_row(3)
[0, 0, 0]