/tg/ Station 13 - Modules - TypesVar Details - Proc Details

/datum/poll_option

Datum which holds details of a poll option loaded from the database.

Used to minimize the need for querying this data every time it's needed.

Vars

default_percentage_calcHint for statbus, not used by the game; If this option should be included by default when calculating the resulting percentages of all options for this poll
desc_maxOptional for rating polls, description shown next to the maximum value
desc_midOptional for rating polls, description shown next to the rounded whole middle value
desc_minOptional for rating polls, description shown next to the minimum value
max_valFor rating polls, the maximum selectable value allowed; Supported value range is -2147483648 to 2147483647
min_valFor rating polls, the minimum selectable value allowed; Supported value range is -2147483648 to 2147483647
option_idTable id of this option, will be null until poll has been created.
parent_pollReference to the poll this option belongs to
textDescription/name of this option

Procs

delete_optionSets a poll option and its votes as deleted in the database then deletes its datum.
save_optionInserts or updates a poll option to the database.

Var Details

default_percentage_calc

Hint for statbus, not used by the game; If this option should be included by default when calculating the resulting percentages of all options for this poll

desc_max

Optional for rating polls, description shown next to the maximum value

desc_mid

Optional for rating polls, description shown next to the rounded whole middle value

desc_min

Optional for rating polls, description shown next to the minimum value

max_val

For rating polls, the maximum selectable value allowed; Supported value range is -2147483648 to 2147483647

min_val

For rating polls, the minimum selectable value allowed; Supported value range is -2147483648 to 2147483647

option_id

Table id of this option, will be null until poll has been created.

parent_poll

Reference to the poll this option belongs to

text

Description/name of this option

Proc Details

delete_option

Sets a poll option and its votes as deleted in the database then deletes its datum.

save_option

Inserts or updates a poll option to the database.

Uses INSERT ON DUPLICATE KEY UPDATE to handle both inserting and updating at once. The list of columns and values is built dynamically to avoid excess data being sent when not a rating type poll.