This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varAlcohol = $("[name='escreen[alcohol]']").val(); | |
varMarijuana = $("[name='escreen[marijuana]']").val(); | |
varElse = $("[name='escreen[anything_else]']").val(); | |
var $select = $(varAlcohol & varMarijuana & varElse), | |
getAllValues = function() { | |
return $select.map(function() { | |
return this.value; | |
}).get(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SINGLE VALUE (WORKS) | |
validates :relationship_other, presence: true, if: Proc.new { |o| o.relationship == 'Other' } | |
# FLAGS VALIDATION WHEN 'OTHER' IS SELECTED, DOES NOT FLAG WHEN 'OTHER FAMILY MEMBER' IS SELECTED | |
validates :relationship_other, presence: true, if: Proc.new { |o| o.relationship == 'Other' } || Proc.new { |o| o.relationship == 'Other Family Member' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@referral = Referral.new(referral_params) | |
begin | |
params[:referral][:dob] = Date.strptime(params[:referral][:dob], '%m/%d/%Y') | |
rescue | |
@referral.errors.add(:dob, 'Invalid Date') | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
params[:referral][:dob] = Date.strptime(params[:referral][:dob], '%m/%d/%Y') | |
@referral = Referral.new(referral_params) | |
if verify_recaptcha(:model => @referral, message: "Please click the box labeled 'I'm not a robot' above.") && @referral.save | |
redirect_to confirmation_page_referrals_path, notice: "Thank you for submitting this referral to Eminence Healthcare." | |
else | |
render :new | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runquery = Student.joins(:user) | |
runquery = runquery.where(users: {first_name: params[:first_name]}) if params[:first_name].present? | |
runquery = runquery.where(users: {last_name: params[:last_name]}) if params[:last_name].present? | |
runquery = runquery.where(users: {social_security_no: params[:social_security_no]}) if params[:social_security_no].present? | |
runquery = runquery.where(program: params[:program]) if params[:program].present? | |
runquery = runquery.select('students.*, students.id as sid, users.*') | |
@query = runquery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.calculate_drug_usage(drug) | |
if drug == "alcohol" | |
map = DrugAssessment.where(student_id: students_of_school).map { |m| [m.date, m.alcohol.to_i]} | |
else | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Efficiency < ActionMailer::Base | |
default from: "e@eminencehc.com" | |
def blast(date, int) | |
attachments.inline['ecore2.png'] = File.read(Rails.root.join('app/assets/images/mail_attachments/ecore2.png')) | |
@date = date.to_date | |
@int = int | |
@counselor_blast = EpitomaxServiceUtilization.new(@date).counselor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EpitomaxServiceImport | |
#ActiveModel::Model | |
extend ActiveModel::Naming | |
include ActiveModel::Conversion | |
include ActiveModel::Validations | |
attr_accessor :file | |
def initialize(attributes = {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Calculation < ActiveRecord::Base | |
def initialize(date) | |
@date = date | |
end | |
self.calculate_date | |
@date = @date + 1.day | |
return @date | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Calculation < ActiveRecord::Base | |
self.abstract_class = true | |
include ActiveModel::Model | |
def initialize(date) | |
@date = date | |
end | |
def plus_one_day |