matthew.lee-reedbusiness.com
-
2/17/2009 7:48:36 PM
Poll Module - Suggestions
I have added the poll module to a website and found 2 issues.
1. The width of the "Majority Vote" Graph bar is always 100%.
I looked at the source code and found out the reasion. The current ratio equation is ratio = currentValue / maxValue. If we use ratio = currentValue / countSummary. The width of the graph bars would be displayed in term of their percentages.
2. ShowGraph properties
If now we set the ShowGraph property = false, the graph bar and results would be displayed until someone submits an answer. Page reloads and shows the bar and results. However, when the page refresh again, both checkbox and results were not shown. Below is the code I found to fix this issue.
In the CreateAnswerSection(bool reload) method before the CreateGraph function, we could add one more condition - (this.CheckVoted && PollInfoProvider.HasVoted(pi.PollID)). This would resolve the issue.
if ((this.ShowGraph) || ((reload) && (this.ShowResultsAfterVote)) || (this.CheckVoted && PollInfoProvider.HasVoted(pi.PollID))). { // Create graph under the answer CreateGraph(maxCount, ValidationHelper.GetInteger(row["AnswerCount"], 0), sumCount, index); }
|