From feedback on the script's post, I have decided to turn this into a service, to help those who are running contests.
NOTE: I might not have used the correct tags for this post, to maximize visibility. Please let me know if there are other "contest"-type tags I should be using instead? Thanks! Also, if you care to resteem this, I'll appreciate! :)
So, instead of making an "all sizes fit one" and forcing everyone to tell their followers to format their voting comments "just so" (which is almost impossible to get people to do), I want to first ask for feedback from the community: if you have run a contest, please give me a link to that contest in a comment, so that I can check its formatting -- I can use the contests that people give me as "test cases".
The basic input variables, and what they would have been for my post:
- url = URL to the post;
- selfvote = 0, 1, or 2: whether to allow self votes: 0 means no; 1 means yes; 2 means invalidate all votes from a self-voter (2 for mine, although fortunately there weren't any!)
- votesperaccount = number of votes each account can cast, and if they make more than this, remove the oldest when the newest is added (5 for mine)
- numwinners = number of winners (50 for mine)
- qualify = I will need to figure out how to do this. In my contest, a votee qualified if their "(followers * 10) + STEEM Power" was < 10,000. I'll need to allow for various forms of equations, for instance not everyone will use the same formula as me. And, some contests might want to include a narrow range (i.e., perhaps "dolphins"), meaning the exclusion would be both "must be above this mark" and "must be below this mark". So this one will require some thought/feedback.
- Also there might be "votingkeywords" -- for instance, the goal of the contest might not be voting for other users; might be voting for certain options that the contest runner chooses -- for instance, "what color should my new car be: red, green, or blue?" So "red" "green" and "blue" would be the votingkeywords, and any instance of those words in the comments would mean that user chose to vote on it.
- Since some users might want to "discuss" in the comments as they normally do, might want to have a "requiredkeyword" like "I nominate" or "My votes:" which the contest runner would indicate to use in the contest instructions in the blog post. Note that even though I specifically said "no self votes" as the first instruction, I still had at least one person ask "can I self vote?" (They didn't, though, even though I didn't answer -- too many comments!)
It would then read in the contest, gathering all the comments, and parse them. The user posting the comment would be the one voting. If more votes were made than "votesperaccount", it would keep the last ones. However, a part that I had to add to my script -- if a user votes for the same account again, just discard it, don't replace, because that threw it off for my recent contest.
Then it would count the votes for each votee, and determine which were the top "numwinners", accounting for removal of self-votes (if "selfvote" set to 0), and removal of all votes from a self-voter (if "selfvote" set to 2).
Next it would scan through each winner (if the winner was specified to be an account -- I'll need to figure out how to specify "qualify" as this moves forward), and determine whether that winner qualified; if not, put them on a "disqualified" list and move the rest up, then add the top-voted account that didn't win into the lowest spot, and continue checking.
Finally, it would email the contest runner, with all details. Might have it include a CSV for each list as well, those being: winners; disqualified; not-winners; self-voters (whose other votes were included, if "selfvote" was 1, or whose other votes were discarded, if "selfvote" was 2).
A feature I just thought of: in the contest I ran, some people formatted the "@username" wrong -- the correctable one (via script) was where there was a space between the "@" and the "username"; others were missing the "@" (which I was able to fix by hand; not sure a script could, though). So it could be run as a "check" ahead of time -- if anyone's comment didn't parse properly, it could leave a comment (or email the contest runner -- or optionally, both I guess), telling the user it couldn't understand their output. It could also leave a note if there weren't enough votes -- e.g., that might indicate the instance above where the "@" had been left out, so that the voter will have a chance to fix their comment before the voting period ends. There are people on Steemit from every country on the plane, and not everybody speaks English very well, so this would be helpful and inclusive.
In fact, I want to specifically call out @soan55, who had posted this comment which I took extra care to understand -- and am glad I did! It is because of her (?) (yes, just checked her blog -- nice pictures!) comment that this service and post are being made!
(Well, several others made similar comments, but it was hers that I saw first.)
I'm a little tired today, although it is great news that the intestinal blockage has worked itself out without my needing to use the enema ("with friends like you, who needs enemas!!?!" :) ), so things are moving properly again. Which, if you haven't experienced it, is just incredibly refreshing. I'm almost positive that this was related to the visit we made to the stem cell clinic last week. Yesterday, I did the research I should have done (which my wife had already done, so we weren't going in blind (well, me only half so :) )) and then did some meditation last night (I might have a post about that soon, was my first "with cannabis" and it led to some really neat thoughts and insights), as the river started flowing again. (Too graphic? Sorry! :) )
Anyway due to being tired, I am running out of steam (heh) working up this post, so I'm just going to leave it in its current form, as I'm really in the "info gathering phase" of this programming task right now.
So: if you've run a contest, please send me URLs to the ones you've run. In fact, even if the contest wasn't yours, if there was one in which the contest runner expressed some angst about how difficult it was to count up the votes, please pass that along as well!
I haven't decided whether to charge for this, and if so, how much. If you have an opinion on what you'd be willing to pay to help save your time, please let me know as well!
Thanks and I hope everybody had a great vacation day today; well, those in the New England states anyway! :)