-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add: Poll voting * bundle update * Update code/controllers/subsystem/non-firing/titlescreen.dm Co-authored-by: PlayerUnknown14 <[email protected]> * ngggh I'll do later. Fixes polling mostly and TGUI. but has SQL issues Column 'createdby_ip' cannot be null INSERT INTO poll_question { ERROR 1048 (23000): Column 'pollid' cannot be null * Final fixes and updates * SQL OOPS ALL MY VERSIONS TO 34 --------- Co-authored-by: PlayerUnknown14 <[email protected]>
- Loading branch information
1 parent
c747908
commit 65724f5
Showing
26 changed files
with
2,331 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Adds poll related. Poll question as body, options inside body, textreply and vote as player answers | ||
-- | ||
-- Table structure for table `poll_question` | ||
-- | ||
DROP TABLE IF EXISTS `poll_question`; | ||
CREATE TABLE IF NOT EXISTS `poll_question` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`polltype` enum('Single Option','Text Reply','Rating','Multiple Choice') NOT NULL, | ||
`created_datetime` datetime NOT NULL, | ||
`starttime` datetime NOT NULL, | ||
`endtime` datetime NOT NULL, | ||
`question` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, | ||
`subtitle` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | ||
`adminonly` tinyint(1) unsigned NOT NULL, | ||
`multiplechoiceoptions` int(2) DEFAULT NULL, | ||
`createdby_ckey` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL, | ||
`dontshow` tinyint(1) unsigned NOT NULL, | ||
`minimum_playtime` int(4) NOT NULL, | ||
`allow_revoting` tinyint(1) unsigned NOT NULL, | ||
`deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', | ||
PRIMARY KEY (`id`), | ||
KEY `idx_pquest_question_time_ckey` (`question`,`starttime`,`endtime`,`createdby_ckey`), | ||
KEY `idx_pquest_time_deleted_id` (`starttime`,`endtime`, `deleted`, `id`), | ||
KEY `idx_pquest_id_time_type_admin` (`id`,`starttime`,`endtime`,`polltype`,`adminonly`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | ||
|
||
-- | ||
-- Table structure for table `poll_option` | ||
-- | ||
DROP TABLE IF EXISTS `poll_option`; | ||
CREATE TABLE IF NOT EXISTS `poll_option` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`pollid` int(11) NOT NULL, | ||
`text` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, | ||
`minval` int(3) DEFAULT NULL, | ||
`maxval` int(3) DEFAULT NULL, | ||
`descmin` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | ||
`descmid` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | ||
`descmax` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | ||
`default_percentage_calc` tinyint(1) unsigned NOT NULL DEFAULT '1', | ||
`deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', | ||
PRIMARY KEY (`id`), | ||
KEY `idx_pop_pollid` (`pollid`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | ||
|
||
-- | ||
-- Table structure for table `poll_textreply` | ||
-- | ||
DROP TABLE IF EXISTS `poll_textreply`; | ||
CREATE TABLE IF NOT EXISTS `poll_textreply` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`datetime` datetime NOT NULL, | ||
`pollid` int(11) NOT NULL, | ||
`ckey` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL, | ||
`replytext` varchar(2048) COLLATE utf8mb4_unicode_ci NOT NULL, | ||
`adminrank` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL, | ||
`deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', | ||
PRIMARY KEY (`id`), | ||
KEY `idx_ptext_pollid_ckey` (`pollid`,`ckey`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | ||
|
||
-- | ||
-- Table structure for table `poll_vote` | ||
-- | ||
DROP TABLE IF EXISTS `poll_vote`; | ||
CREATE TABLE IF NOT EXISTS `poll_vote` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`datetime` datetime NOT NULL, | ||
`pollid` int(11) NOT NULL, | ||
`optionid` int(11) NOT NULL, | ||
`ckey` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL, | ||
`adminrank` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL, | ||
`rating` int(2) DEFAULT NULL, | ||
`deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', | ||
PRIMARY KEY (`id`), | ||
KEY `idx_pvote_pollid_ckey` (`pollid`,`ckey`), | ||
KEY `idx_pvote_optionid_ckey` (`optionid`,`ckey`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | ||
|
||
DELIMITER $$ | ||
DROP PROCEDURE IF EXISTS `set_poll_deleted`; | ||
CREATE PROCEDURE `set_poll_deleted`( | ||
IN `poll_id` INT | ||
) | ||
SQL SECURITY INVOKER | ||
BEGIN | ||
UPDATE `poll_question` SET deleted = 1 WHERE id = poll_id; | ||
UPDATE `poll_option` SET deleted = 1 WHERE pollid = poll_id; | ||
UPDATE `poll_vote` SET deleted = 1 WHERE pollid = poll_id; | ||
UPDATE `poll_textreply` SET deleted = 1 WHERE pollid = poll_id; | ||
END | ||
$$ | ||
DELIMITER ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
//unmagic-strings for types of polls, used by SQL don't change these | ||
#define POLLTYPE_OPTION "Single Option" | ||
#define POLLTYPE_TEXT "Text Reply" | ||
#define POLLTYPE_RATING "Rating" | ||
#define POLLTYPE_MULTI "Multiple Choice" | ||
|
||
#define POLL_SECOND "SECOND" | ||
#define POLL_MINUTE "MINUTE" | ||
#define POLL_HOUR "HOUR" | ||
#define POLL_DAY "DAY" | ||
#define POLL_WEEK "WEEK" | ||
#define POLL_MONTH "MONTH" | ||
#define POLL_YEAR "YEAR" | ||
|
||
///The message sent when you sign up to a poll. | ||
#define POLL_RESPONSE_SIGNUP "signup" | ||
///The message sent when you've already signed up for a poll and are trying to sign up again. | ||
#define POLL_RESPONSE_ALREADY_SIGNED "already_signed" | ||
///The message sent when you are not signed up for a poll. | ||
#define POLL_RESPONSE_NOT_SIGNED "not_signed" | ||
///The message sent when you are too late to unregister from a poll. | ||
#define POLL_RESPONSE_TOO_LATE_TO_UNREGISTER "failed_unregister" | ||
///The message sent when you successfully unregister from a poll. | ||
#define POLL_RESPONSE_UNREGISTERED "unregistered" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.