<commit_before>class NotificationController < ApplicationController
	include NotificationHelper

	def index

	end

	def receive_sms
		text = read_received_sms
		arr = text.body.split(",")
		hash_tag = arr[0].strip
		name = arr[1]

		phone_number = text.from
		user = User.find_by(phone_number: phone_number)
		@party = Party.where(hash_tag: hash_tag)


		what_song = "What song do you wanna sing?"
		wrong_format = "Wrong Format. Please Try Again!
		Format: (#hashtag, name)"

		if !user
			if @party.empty?
				send_sms(phone_number, wrong_format)
			else
				user = User.create(name: name, phone_number: phone_number, party_id: @party.first.id)
				send_sms(user.phone_number, what_song)
			end
		end
	end


	def authenticate

	end

end

# first text should contain (hashtag, name)
# check if phone_number is in database
# if not user,
	#check format of text for hashtag
		#if hashtag exists
			#create user with (name, phone, hashtag)
			#send text back saying: "you've been authenticated!, what song buddy?"
		#else
			# send sms please specify what party you are in
# elsif user
	#check format of text for artist and song
		#if artist and song exists
			#save song to
<commit_msg>Completing Twilio logic, in working order<commit_after>class NotificationController < ApplicationController
	include NotificationHelper

	def index

	end

	def receive_sms
		text = read_received_sms
		phone_number = text.from
		arr = text.body.split(",")

		user = User.find_by(phone_number: phone_number)

		if arr[0][0].include?("#")
			hashtag = arr[0].strip
			name = arr[1]
			party = Party.where(hash_tag: hash_tag)
		else
			song_info = arr.join
		end

		wrong_format = "Wrong Format. Please Try Again!
		Format: (#hashtag, name)"
		what_song = "You are on your way to becoming a SuprStar! What song would you like to sing?"
		confirm_song = "You are one step closer SuprStar! Get ready to sing #{song_info}!"

		if !user
			if party.empty?
				send_sms(phone_number, wrong_format)
			else
				user = User.create(name: name, phone_number: phone_number, party_id: party.first.id)
				send_sms(user.phone_number, what_song)
			end
		else
			if song_info
				Song.create(name: song_info, user_id: user.id, party_id: user.party.id)
				send_sms(user.phone_number, confirm_song)
			else
				send_sms(user.phone_number, what_song)
			end
		end
	end


	def authenticate

	end

end

{'fraction_non_alphanumeric': 0.0874894336432798, 'fraction_numerical': 0.00253592561284869, 'mean_word_length': 3.8109756097560976, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6528897', 'n_tokens_mistral': 932, 'n_tokens_neox': 797, 'n_words': 247}