Readds percentagecalc as default_display_in_results (#28840)

* readds percentagecalc as default_display_in_results with a prompt explaining what it actually does

* default 1

* tabsplz

* Update database_changelog.txt

* Update tgstation_schema.sql

* Update database_changelog.txt

* Update tgstation_schema_prefixed.sql

* Update create_poll.dm
This commit is contained in:
Jordie
2017-06-28 11:43:49 +10:00
committed by Jordan Brown
parent 17e46a49b4
commit 27276ca3bb
4 changed files with 22 additions and 1 deletions

View File

@@ -1,3 +1,13 @@
26 June 2017, by Jordie0608
Modified table 'poll_option', adding the column 'default_percentage_calc'.
ALTER TABLE `poll_option` ADD COLUMN `default_percentage_calc` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' AFTER `descmax`
Remember to add a prefix to the table name if you use them.
----------------------------------------------------
22 June 2017, by Jordie0608
Modified table 'poll_option', removing the column 'percentagecalc'.

View File

@@ -290,6 +290,7 @@ CREATE TABLE `poll_option` (
`descmin` varchar(32) DEFAULT NULL,
`descmid` varchar(32) DEFAULT NULL,
`descmax` varchar(32) DEFAULT NULL,
`default_percentage_calc` tinyint(1) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `idx_pop_pollid` (`pollid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

View File

@@ -290,6 +290,7 @@ CREATE TABLE `SS13_poll_option` (
`descmin` varchar(32) DEFAULT NULL,
`descmid` varchar(32) DEFAULT NULL,
`descmax` varchar(32) DEFAULT NULL,
`default_percentage_calc` tinyint(1) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `idx_pop_pollid` (`pollid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

View File

@@ -69,6 +69,15 @@
if(!option)
return
option = sanitizeSQL(option)
var/default_percentage_calc
if(polltype != POLLTYPE_IRV)
switch(alert("Should this option be included by default when poll result percentages are generated?",,"Yes","No","Cancel"))
if("Yes")
default_percentage_calc = 1
if("No")
default_percentage_calc = 0
else
return
var/minval = 0
var/maxval = 0
var/descmin = ""
@@ -103,7 +112,7 @@
descmax = sanitizeSQL(descmax)
else if(descmax == null)
return
sql_option_list += list(list("text" = "'[option]'", "minval" = "'[minval]'", "maxval" = "'[maxval]'", "descmin" = "'[descmin]'", "descmid" = "'[descmid]'", "descmax" = "'[descmax]'"))
sql_option_list += list(list("text" = "'[option]'", "minval" = "'[minval]'", "maxval" = "'[maxval]'", "descmin" = "'[descmin]'", "descmid" = "'[descmid]'", "descmax" = "'[descmax]'", "default_display_in_results" = "'[default_percentage_calc]'"))
switch(alert(" ",,"Add option","Finish", "Cancel"))
if("Add option")
add_option = 1