Beispiel #1
0
        /// <summary>
        /// Store original plan name and contents in reference containers.
        /// </summary>
        /// <param name="plans">A list of valid plans.</param>
        private void StorePlanReferences(IEnumerable <List <string> > plans)
        {
            foreach (var plan in plans)
            {
                string planName  = VoteString.GetPlanName(plan.First());
                string cleanName = VoteString.RemoveBBCode(planName);
                cleanName = VoteString.DeUrlContent(cleanName);


                if (!VoteCounter.ReferencePlanNames.Contains(cleanName, Agnostic.StringComparer))
                {
                    VoteCounter.ReferencePlanNames.Add(cleanName);
                    VoteCounter.ReferencePlans[cleanName] = plan;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Put any plans found in the grouped vote lines into the standard tracking sets,
        /// after handling any partitioning needed.
        /// </summary>
        /// <param name="plans">List of plans to be processed.</param>
        /// <param name="post">Post the plans were pulled from.</param>
        /// <param name="partitionMode">Partition mode being used.</param>
        private void ProcessPlans(IEnumerable <List <string> > plans, PostComponents post, PartitionMode partitionMode)
        {
            foreach (var plan in plans)
            {
                string planName  = VoteString.GetMarkedPlanName(plan.First());
                string cleanName = VoteString.RemoveBBCode(planName);
                cleanName = VoteString.DeUrlContent(cleanName);

                if (!VoteCounter.HasPlan(cleanName))
                {
                    var nPlan = NormalizePlanName(plan);

                    // Get the list of all vote partitions, built according to current preferences.
                    // One of: By line, By block, or By post (ie: entire vote)
                    var votePartitions = GetVotePartitions(nPlan, partitionMode, VoteType.Plan, post.Author);

                    VoteCounter.AddVotes(votePartitions, cleanName, post.ID, VoteType.Plan);
                }
            }
        }