Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
6ec3c300
Commit
6ec3c300
authored
8 years ago
by
nightfox
Browse files
Options
Downloads
Patches
Plain Diff
Version 1.17 beta 17: Fixed a bug in saving & reading poll vote answers.
parent
7dfe126e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xtrn/DDMsgReader/DDMsgReader.js
+13
-12
13 additions, 12 deletions
xtrn/DDMsgReader/DDMsgReader.js
with
13 additions
and
12 deletions
xtrn/DDMsgReader/DDMsgReader.js
+
13
−
12
View file @
6ec3c300
...
...
@@ -301,7 +301,7 @@ if (system.version_num < 31500)
}
// Reader version information
var READER_VERSION = "1.17 Beta 1
6
";
var READER_VERSION = "1.17 Beta 1
7
";
var READER_DATE = "2016-12-04";
// Keyboard key codes for displaying on the screen
...
...
@@ -14011,13 +14011,10 @@ function DigDistMsgReader_VoteOnMessage(pMsgHdr, pRemoveNLsFromVoteText)
var selectHdr = bbs.text(typeof(SelectItemHdr) != "undefined" ? SelectItemHdr : 501);
printf("\1n" + selectHdr + "\1n", pMsgHdr.subject);
var optionFormatStr = "\1n\1c\1h%2d\1n\1c: \1h%s\1n";
var numCommentLines = 0;
var optionNum = 1;
for (var fieldI = 0; fieldI < pMsgHdr.field_list.length; ++fieldI)
{
if (pMsgHdr.field_list[fieldI].type == SMB_COMMENT)
++numCommentLines;
else if (pMsgHdr.field_list[fieldI].type == SMB_POLL_ANSWER)
if (pMsgHdr.field_list[fieldI].type == SMB_POLL_ANSWER)
{
printf(optionFormatStr, optionNum++, pMsgHdr.field_list[fieldI].data);
console.crlf();
...
...
@@ -14034,15 +14031,17 @@ function DigDistMsgReader_VoteOnMessage(pMsgHdr, pRemoveNLsFromVoteText)
// TODO: Update to support multiple answers from the user
var userInputNum = console.getnum(maxNum);
console.print("\1n");
if (userInputNum == 0) // The user just pressed enter to choose the default
userInputNum = 1;
//
if (userInputNum == 0) // The user just pressed enter to choose the default
//
userInputNum = 1;
if (userInputNum == -1) // The user chose Q to quit
retObj.userQuit = true;
else
{
// It seems the user's choice needs to be incremented by 1 less
// than the number of comment lines
userInputNum += (numCommentLines-1);
// The user's answer is 0-based, so if userInputNum is positive,
// subtract 1 from it (if it's already 0, that means the user
// chose to keep the default first answer).
if (userInputNum > 0)
--userInputNum;
var votes = (1 << userInputNum);
voteMsgHdr.attr = MSG_VOTE;
voteMsgHdr.votes = votes;
...
...
@@ -14234,6 +14233,7 @@ function DigDistMsgReader_GetMsgBody(pMsgHdr)
var optionNum = 1;
var numVotes = 0;
var votePercentage = 0;
var tallyIdx = 0;
for (var fieldI = 0; fieldI < pMsgHdr.field_list.length; ++fieldI)
{
if (pMsgHdr.field_list[fieldI].type == SMB_COMMENT)
...
...
@@ -14244,9 +14244,9 @@ function DigDistMsgReader_GetMsgBody(pMsgHdr)
// vote percentage
if (pMsgHdr.hasOwnProperty("tally"))
{
if (
fieldI
< pMsgHdr.tally.length)
if (
tallyIdx
< pMsgHdr.tally.length)
{
numVotes = pMsgHdr.tally[
fieldI
];
numVotes = pMsgHdr.tally[
tallyIdx
];
votePercentage = (numVotes / totalNumVotes) * 100;
}
}
...
...
@@ -14257,6 +14257,7 @@ function DigDistMsgReader_GetMsgBody(pMsgHdr)
if (numVotes > 0)
msgBody += " " + CHECK_CHAR;
msgBody += "\r\n";
++tallyIdx;
}
}
if (pollComment.length > 0)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment