示例#1
0
	def POST(self):
		# password gaurentees someone IN open ears ends the pair
		form = web.input(warrior="warrior", netid   ="netid",
						 notes  ="notes"  , password="******")
		
		if form.password == cv.secret([3,3,1]):
			#friend types netID and uses it to pair
			sheet = cv.open_sheet('Friend-List')
			name_col  = cv.search_row(sheet, 1, 'name')
			netid_col = cv.search_row(sheet, 1, 'netid')
			row_num = cv.search_column(sheet, netid_col, form.netid)

			# find the name of the user within the sheet
			name_values = sheet.col_values(name_col)
			friend = name_values[row_num - 1]
		
		
			pair = [form.warrior, friend]
			#removes given pair from Current-Pairings 
			#and updates status in All-Pairings
			if cv.remove_pair(pair) == 'Pair Removed':
					if cv.update_all_pair(pair, form.notes) == 'Pair Does Not Exist':
						pair = [['PAIR NOT'],['FOUND']]
			else:
				pair = [['PAIR NOT'],['FOUND']]
			
			data = [pair, form.notes]
		else:
			#extras because len(1 and 2) conditionals already taken
			data = ["Incorrect Password! Please try again.",3 ,4]
		
		return render.end_pair(table = data)
示例#2
0
	def POST(self):
		# retrieve data from request
		# form.netid - friend's netid to remove from queue
		form = web.input(netid = "netid")

		# find the corresponding columns within the sheet Friend-List
		sheet = cv.open_sheet('Friend-List')
		name_col  = cv.search_row(sheet, 1, 'name')
		netid_col = cv.search_row(sheet, 1, 'netid')
		
		row_num = cv.search_column(sheet, netid_col, form.netid)
		
		#this wont work if we have more than 950 entries.
		#thats ALOOOOOOT of people on the queue
		if row_num < 950:
			# find the name of the user within the sheet
			name_values = sheet.col_values(name_col)
			name = name_values[row_num - 1]
		
			# remove the user from the queue
			cv.remove_from_queue("Friend-Q", name, 'rm all')
			choice = 2
		else:
			#cant find netid error message
			choice = 3		
			
		# render /remove
		return render.remove(option = choice)
示例#3
0
	def POST(self):
		# password gaurentees someone IN open ears ends the pair
		form = web.input(warrior = "warrior", netid = "netid",
						 notes   = "notes")
		
		#friend types netID and uses it to pair
		sheet = cv.open_sheet('Friend-List')
		name_col  = cv.search_row(sheet, 1, 'name')
		netid_col = cv.search_row(sheet, 1, 'netid')
		row_num = cv.search_column(sheet, netid_col, form.netid)
		
		# find the name of the user within the sheet
		name_values = sheet.col_values(name_col)
		friend = name_values[row_num - 1]
		
		
		pair = [form.warrior, friend]
		#removes given pair from Current-Pairings 
		#and updates status in All-Pairings
		if cv.remove_pair(pair) == 'Pair Removed':
			if cv.update_all_pair(pair, form.notes) == 'Pair Does Not Exist':
				pair = [['PAIR NOT'],['FOUND']]
		else:
			pair = [['PAIR NOT'],['FOUND']]
		
		data = [pair, form.notes]	
		return render.end_pair(table = data)
示例#4
0
	def POST(self):
		# retrieve data from request
		# form.netid - friend's netid to remove from queue
		form = web.input(netid = "netid")

		# find the corresponding columns within the sheet Friend-List
		sheet = cv.open_sheet('Friend-List')
		name_col  = cv.search_row(sheet, 1, 'name')
		netid_col = cv.search_row(sheet, 1, 'netid')
		
		row_num = cv.search_column(sheet, netid_col, form.netid)
		
		#this wont work if we have more than 950 entries.
		#thats ALOOOOOOT of people on the queue
		if row_num < 950:
			# find the name of the user within the sheet
			name_values = sheet.col_values(name_col)
			name = name_values[row_num - 1]
		
			# remove the user from the queue
			cv.remove_from_queue("Friend-Q", name, form.netid, 'rm all')
			choice = 2
		else:
			#cant find netid error message
			choice = 3		
			
		# render /remove
		return render.remove(option = choice)
示例#5
0
	def POST(self):	
		# recieve user information from POST request
		# form.netid - netid of the friend to be paired
		# form.number - number of times the friend wants to be paired
		form = web.input(netid = "netid", number = 1)
	
		# initialization
		num = int(form.number)
		sheet = cv.open_sheet('Friend-List')
		
		# find the column number for name, netid, and verified
		name_col  = cv.search_row(sheet, 1, 'name')
		netid_col = cv.search_row(sheet, 1, 'netid')
		#fill in name of "verified" column title correctly
		veri_col  = cv.search_row(sheet, 1, 'trained')

		# find the users row within the spreadsheet
		row_num = cv.search_column(sheet, netid_col, form.netid)

		# if more than 1000 people sign up or if the spreadsheet is resized to > 1000.
		if row_num >= 1000:
			message = "FAILURE! We could not find your netID on the list. Please make sure you submitted the correct netID (%s). If this is the correct netID it is possible that was incorrectly entered on our spreadsheet or there is something wrong with this code (which is a very likely possibility). Please let us know about this problem, whether through our website, facebook, slack, next meeting, or randomly in the quad. THANK YOU!" % form.netid	

		else:
			the_values = sheet.row_values(row_num)
			
			# retrieve the friend's name and if they are verified
			name = the_values[name_col - 1] # -1 due to 1 indexing for spreadsheets
			verified = the_values[veri_col - 1]
	
			# if verified add to friend queue num (form.number) times.
			if verified.lower().strip() == 'yes':
				# names must be submitted as an array to the add_to_queue function
				cv.add_to_queue("Friend-Q", name, num)				
				message = "SUCCESS!"
				
			else:
				message = "FAILURE! You're name is on the list but it looks like you have not been verified. In order to become verified you must come to a sufficient amount of trainings. At the trainings we go over situations you may encounter and talk about what the process of being a friend will be like (good ole logistics and all.) It is really quite fun. Once there was even candy. So please try to come out if you have not yet. If anything you'll at least learn how this stupid interface works. If you believe you have been verified though and have gone through trainings then please let somebody know so they can fix it. Again, its a stupid interface. But with your help maybe it can just be dumb."

		# render /add and pass the message and number of times added to the user
		return render.add(stuff = [message, num])
示例#6
0
	def POST(self):	
		# recieve user information from POST request
		# form.netid - netid of the friend to be paired
		# form.number - number of times the friend wants to be paired
		form = web.input(netid = "netid", number = 1)
	
		# initialization
		num = int(form.number)
		sheet = cv.open_sheet('Friend-List')
		
		# find the column number for name, netid, and verified
		name_col  = cv.search_row(sheet, 1, 'name')
		netid_col = cv.search_row(sheet, 1, 'netid')
		#fill in name of "verified" column title correctly
		veri_col  = cv.search_row(sheet, 1, 'trained')

		# find the users row within the spreadsheet
		row_num = cv.search_column(sheet, netid_col, form.netid)

		# if more than 1000 people sign up or if the spreadsheet is resized to > 1000.
		if row_num >= 1000:
			message = "FAILURE! We could not find your netID on the list. Please make sure you submitted the correct netID (%s). If this is the correct netID it is possible that was incorrectly entered on our spreadsheet or there is something wrong with this code (which is a very likely possibility). Please let us know about this problem, whether through our the suggestions link above, facebook, slack, the next meeting, or randomly in the quad. THANK YOU!" % form.netid	

		else:
			the_values = sheet.row_values(row_num)
			
			# retrieve the friend's name and if they are verified
			name = the_values[name_col - 1] # -1 due to 1 indexing for spreadsheets
			verified = the_values[veri_col - 1]
	
			# if verified add to friend queue num (form.number) times.
			if verified.lower().strip() == 'yes':
				# names must be submitted as an array to the add_to_queue function
				cv.add_to_queue("Friend-Q", name, form.netid, num)				
				message = "SUCCESS!"
				
			else:
				message = "FAILURE! You're name is on the list but it looks like you have not been trained. In order to become trained you must come to a sufficient amount of trainings. While there we go over situations you may encounter and talk about what the process of being a friend will be like (good ole logistics and all.) It is really quite fun. Once there was even candy. So please try to come out if you have not yet. If anything you'll at least learn how this stupid interface works. (We may also be going through kognito too.) If you believe you have been trained though and have gone through trainings then please let somebody know so they can fix it. Again, its a stupid interface. But with your help maybe it can just be dumb."

		# render /add and pass the message and number of times added to the user
		return render.add(stuff = [message, num])