<commit_before>class TextController < ApplicationController
require 'rubygems'
require "twilio-ruby"
before_filter :require_user

def index
	@value = ''
end
    
def create
	@invalid_num = Array.new
	if params[:commit]== 'Send To All!'
		send_to_all()
	else 
	
	num = params[:number].to_s.delete! '[\"]'
	mult_nums = num.split(', ')
	
	mult_nums.each {|x| send_text(x)}
	end
	if @invalid_num.length != 0
		if @invalid_num[0] == "No Message"
			flash[:notice] = "Message Required"
			@value = num
		else
		inv_num = @invalid_num.to_s.delete! '\"'
		flash[:notice] = "The number(s) #{inv_num} are invalid, others sent successfully"
		inv_num.delete! '[]'
		@value = inv_num
		end
	else
		flash[:notice] = "Message sent successfully."
	end
	render('index')
end

def send_to_all
	students = Student.all 
	students.each do |student|
		send_text(student.Phone_Number)
	end
end

def send_text(number)
	if params[:message] == [""]
		@invalid_num << "No Message"
	elsif number.match(/\b\d{10}\b/)
   		number = '+1' + number
     	account_sid = 'AC<KEY>'
		auth_token = '4<PASSWORD>'
		@client = Twilio::REST::Client.new account_sid, auth_token
		message = @client.account.messages.create(:body => params[:message],
		:to => number,
		:from => "+16412434422")
		puts message.sid
	else
		@invalid_num << number
	end
end
<commit_msg>Added: Number of messages is plural/not<commit_after>class TextController < ApplicationController
require 'rubygems'
require "twilio-ruby"
before_filter :require_user

def index
	@value = ''
end
    
def create
	@invalid_num = Array.new
	if params[:commit]== 'Send To All!'
		send_to_all()
	else 
	
	num = params[:number].to_s.delete! '[\"]'
	mult_nums = num.split(', ')
	num_texts = mult_nums.length
	
	mult_nums.each {|x| send_text(x)}
	end
	if @invalid_num.length != 0
		if @invalid_num[0] == "No Message"
			flash[:notice] = "Message Required"
			@value = num
		else
		inv_num = @invalid_num.to_s.delete! '\"'
		flash[:notice] = "The number(s) #{inv_num} are invalid, others sent successfully"
		inv_num.delete! '[]'
		@value = inv_num
		end
	else
		if num_texts > 1
		    flash[:notice] = "Messages sent successfully."
		else
		    flash[:notice] = "Message sent successfully."     
		end
	end
	render('index')
end

def send_to_all
	students = Student.all 
	students.each do |student|
		send_text(student.Phone_Number)
	end
end

def send_text(number)
	if params[:message] == [""]
		@invalid_num << "No Message"
	elsif number.match(/\b\d{10}\b/)
   		number = '+1' + number
     	account_sid = 'ACc3ff9be899397461c075ffcf9e70f35a'
		auth_token = '<PASSWORD>'
		@client = Twilio::REST::Client.new account_sid, auth_token
		message = @client.account.messages.create(:body => params[:message],
		:to => number,
		:from => "+16412434422")
		puts message.sid
	else
		@invalid_num << number
	end
end

{'fraction_non_alphanumeric': 0.14397163120567377, 'fraction_numerical': 0.01879432624113475, 'mean_word_length': 4.046511627906977, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3848431', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1036, 'n_words': 240}