<commit_before>/client/verb/cmd_view_polls()
	set category = "Server"
	set name = "View poll results"

	if(!check_rights(R_ADMIN))
		return

	if(!SSdbcore.IsConnected())
		to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
		return

	var/datum/DBQuery/query_poll_get = SSdbcore.NewQuery("SELECT id, question FROM [format_table_name("poll_question")] WHERE Now() > starttime ORDER BY starttime DESC")
	if(!query_poll_get.warn_execute())
		qdel(query_poll_get)
		return
	var/output = "<div align='center'><B>Player polls</B><hr><table>"
	var/i = 0
	var/rs = REF(src)
	while(query_poll_get.NextRow())
		var/pollid = query_poll_get.item[1]
		var/pollquestion = query_poll_get.item[2]
		output += "<tr bgcolor='#[ (i % 2 == 1) ? "e2e2e2" : "e2e2e2" ]'><td><a href=\"byond://?src=[rs];pollidshow=[pollid]\"><b>[pollquestion]</b></a></td></tr>"
		i++
	qdel(query_poll_get)
	output += "</table>"
	if(!QDELETED(src))
		src << browse(output,"window=playerpolllist;size=500x300")


/client/proc/poll_results(var/pollid = -1)
	if(!check_rights(R_ADMIN))
		return
	if(!isnum(pollid))
		return
	if(pollid == -1)
		return
	if(!SSdbcore.IsConnected())
		to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
		return
	var/datum/DBQuery/select_query = SSdbcore.NewQuery("SELECT polltype, question, adminonly, multiplechoiceoptions, starttime, endtime FROM [format_table_name("poll_question")] WHERE id = [pollid]")
	select_query.Execute()
	var/question = ""
	var/polltype = ""
	var/adminonly = 0
	var/multiplechoiceoptions = 0
	var/starttime = ""
	var/endtime = ""
	var/found = 0
	while(select_query.NextRow())
		polltype = select_query.item[1]
		question = select_query.item[2]
		adminonly = text2num(select_query.item[3])
		multiplechoiceoptions = text2num(select_query.item[4])
		starttime = select_query.item[5]
		endtime = select_query.item[6]
		found = 1<commit_msg>Update poll.dm<commit_after>/client/verb/cmd_view_polls()
	set category = "Server"
	set name = "View poll results"

	if(!check_rights(R_ADMIN))
		return

	if(!SSdbcore.IsConnected())
		to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
		return

	var/datum/DBQuery/query_poll_get = SSdbcore.NewQuery("SELECT id, question FROM [format_table_name("poll_question")] WHERE Now() > starttime ORDER BY starttime DESC")
	if(!query_poll_get.warn_execute())
		qdel(query_poll_get)
		return
	var/output = "<div align='center'><B>Player polls</B><hr><table>"
	var/i = 0
	var/rs = REF(src)
	while(query_poll_get.NextRow())
		var/pollid = query_poll_get.item[1]
		var/pollquestion = query_poll_get.item[2]
		output += "<tr bgcolor='#[ (i % 2 == 1) ? "e2e2e2" : "e2e2e2" ]'><td><a href=\"byond://?src=[rs];pollidshow=[pollid]\"><b>[pollquestion]</b></a></td></tr>"
		i++
	qdel(query_poll_get)
	output += "</table>"
	if(!QDELETED(src))
		src << browse(output,"window=playerpolllist;size=500x300")


/client/proc/poll_results(var/pollid = -1)
	if(!check_rights(R_ADMIN))
		return
	if(pollid == -1)
		return
	pollid = text2num(pollid)
	if(!pollid)
		return
	if(!SSdbcore.IsConnected())
		to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
		return
	var/datum/DBQuery/select_query = SSdbcore.NewQuery("SELECT polltype, question, adminonly, multiplechoiceoptions, starttime, endtime FROM [format_table_name("poll_question")] WHERE id = [pollid]")
	select_query.Execute()
	var/question = ""
	var/polltype = ""
	var/adminonly = 0
	var/multiplechoiceoptions = 0
	var/starttime = ""
	var/endtime = ""
	var/found = 0
	while(select_query.NextRow())
		polltype = select_query.item[1]
		question = select_query.item[2]
		adminonly = text2num(select_query.item[3])
		multiplechoiceoptions = text2num(select_query.item[4])
		starttime = select_query.item[5]
		endtime = select_query.item[6]
		found = 1
{'fraction_non_alphanumeric': 0.1636881636881637, 'fraction_numerical': 0.016317016317016316, 'mean_word_length': 5.512647554806071, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 41, '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': '2642976', 'n_tokens_mistral': 1519, 'n_tokens_neox': 1432, 'n_words': 248}