White Sands - Modules - TypesVar Details - Proc Details

/datum/poll_question

Datum which holds details of a running poll loaded from the database and supplementary info.

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

Vars

admin_onlyHides the poll from any client without a holder datum.
allow_revotingAllows a player to change their vote to a poll they've already voted on, off by default.
created_byCkey of the poll's original author
dont_showHint for statbus, not used by the game; Stops the results of a poll from being displayed until the end_datetime is reached.
durationHolds duration data when creating or editing a poll and refreshing the poll creation window.
edit_readyIndicates if a poll has been submitted or loaded from the DB so the management panel will open with edit functions.
end_datetimeDate and time the poll will run until, timestamp format is YYYY-MM-DD HH:MM:SS.
future_pollIndicates a poll is set to not start in the future, still visible for editing but not voting on.
intervalHolds interval data when creating or editing a poll and refreshing the poll creation window.
optionsReference list of the options for this poll, not used by text response polls.
options_allowedThe number of responses allowed in a multiple-choice poll, more can be selected but won't be recorded.
poll_idTable id of this poll, will be null until poll has been created.
poll_typeThe type of poll to be created, must be POLLTYPE_OPTION, POLLTYPE_TEXT, POLLTYPE_RATING, POLLTYPE_MULTI or POLLTYPE_IRV.
poll_votesCount of how many players have voted or responded to this poll.
questionThe title text of the poll, shows up on the list of polls.
start_datetimeDate and time the poll opens, timestamp format is YYYY-MM-DD HH:MM:SS.
subtitleSupplementary text displayed only when responding to a poll.

Procs

clear_poll_votesDeletes all votes or text replies for this poll, depending on its type.
delete_pollSets a poll and its associated data as deleted in the database.
save_all_optionsSaves all options of a poll to the database.
save_poll_dataInserts or updates a poll question to the database.

Var Details

admin_only

Hides the poll from any client without a holder datum.

allow_revoting

Allows a player to change their vote to a poll they've already voted on, off by default.

created_by

Ckey of the poll's original author

dont_show

Hint for statbus, not used by the game; Stops the results of a poll from being displayed until the end_datetime is reached.

duration

Holds duration data when creating or editing a poll and refreshing the poll creation window.

edit_ready

Indicates if a poll has been submitted or loaded from the DB so the management panel will open with edit functions.

end_datetime

Date and time the poll will run until, timestamp format is YYYY-MM-DD HH:MM:SS.

future_poll

Indicates a poll is set to not start in the future, still visible for editing but not voting on.

interval

Holds interval data when creating or editing a poll and refreshing the poll creation window.

options

Reference list of the options for this poll, not used by text response polls.

options_allowed

The number of responses allowed in a multiple-choice poll, more can be selected but won't be recorded.

poll_id

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

poll_type

The type of poll to be created, must be POLLTYPE_OPTION, POLLTYPE_TEXT, POLLTYPE_RATING, POLLTYPE_MULTI or POLLTYPE_IRV.

poll_votes

Count of how many players have voted or responded to this poll.

question

The title text of the poll, shows up on the list of polls.

start_datetime

Date and time the poll opens, timestamp format is YYYY-MM-DD HH:MM:SS.

subtitle

Supplementary text displayed only when responding to a poll.

Proc Details

clear_poll_votes

Deletes all votes or text replies for this poll, depending on its type.

delete_poll

Sets a poll and its associated data as deleted in the database.

Calls the procedure set_poll_deleted to set the deleted column to 1 for each row in the poll_ tables matching the poll id used. Then deletes each option datum and finally the poll itself.

save_all_options

Saves all options of a poll to the database.

Saves all the created options for a poll when it's submitted to the DB for the first time and associated an id with the options. Insertion and id querying for each option is done separately to ensure data integrity; this is less performant, but not significantly. Using MassInsert() would mean having to query a list of rows by poll_id or matching by fields afterwards, which doesn't guarantee accuracy.

save_poll_data

Inserts or updates a poll question to the database.

Uses INSERT ON DUPLICATE KEY UPDATE to handle both inserting and updating at once. The start and end datetimes and poll id for new polls is then retrieved for the poll datum. Arguments: