Exemplo n.º 1
0
        public override void RunAction(ChatExchangeDotNet.Message incomingChatMessage, ChatExchangeDotNet.Room chatRoom)
        {
            // Get the stats
            var sa    = new CloseQueueStatsAccessor();
            var stats = sa.GetOverallQueueStats();

            var statsMessage = new[]
            {
                $"{stats.NeedReview} need review",
                $"{stats.ReviewsToday} reviews today",
                $"{stats.ReviewsAllTime} reviews all-time",
            }
            .ToCSV(Environment.NewLine);

            // Get the next 3 tags
            var tags = SedeAccessor.GetTags(chatRoom, ConfigurationAccessor.LoginEmail, ConfigurationAccessor.LoginPassword);

            if (tags == null)
            {
                chatRoom.PostReplyOrThrow(incomingChatMessage, "My attempt to get tag data returned no information. This could be due to the site being down or blocked for me, or a programming error. Try again in a few minutes, or tell the developer if this happens often.");
                return;
            }

            var topTags = tags
                          .Take(3)
                          .Select(x => $"[tag:{x.Key}]");

            var combinedTags = topTags.ToCSV(", ");

            var tagsMessage = $"The tags to work on are: {combinedTags}.";

            chatRoom.PostMessageOrThrow(statsMessage);
            chatRoom.PostMessageOrThrow(tagsMessage);
        }
Exemplo n.º 2
0
        public override void RunAction(ChatExchangeDotNet.Message incommingChatMessage, ChatExchangeDotNet.Room chatRoom, InstallationSettings roomSettings)
        {
            var sa = new CloseQueueStatsAccessor();
            var message = sa.GetOverallQueueStats();

            chatRoom.PostMessageOrThrow(message);
        }
Exemplo n.º 3
0
        public override void RunAction(ChatExchangeDotNet.Message incommingChatMessage, ChatExchangeDotNet.Room chatRoom, InstallationSettings roomSettings)
        {
            // Get the stats
            var sa = new CloseQueueStatsAccessor();
            var statsMessage = sa.GetOverallQueueStats();

            // Get the next 3 tags
            var tags = SedeAccessor.GetTags(chatRoom, roomSettings.Email, roomSettings.Password);

            if (tags == null)
            {
                chatRoom.PostReplyOrThrow(incommingChatMessage, "My attempt to get tag data returned no information. This could be due to the site being down or blocked for me, or a programming error. Try again in a few minutes, or tell the developer if this happens often.");
                return;
            }

            var topTags = tags
                .Take(3)
                .Select(x => "[tag:{0}]".FormatInline(x.Key));

            var combinedTags = topTags.ToCSV(", ");

            var tagsMessage = "The tags to work on are: {0}.".FormatInline(combinedTags);

            chatRoom.PostMessageOrThrow(statsMessage);
            chatRoom.PostMessageOrThrow(tagsMessage);
        }
Exemplo n.º 4
0
        public override void RunAction(ChatExchangeDotNet.Message incomingChatMessage, ChatExchangeDotNet.Room chatRoom)
        {
            var sa    = new CloseQueueStatsAccessor();
            var stats = sa.GetOverallQueueStats();

            var message = new[]
            {
                $"{stats.NeedReview} need review",
                $"{stats.ReviewsToday} reviews today",
                $"{stats.ReviewsAllTime} reviews all-time",
            }
            .ToCSV(Environment.NewLine);

            chatRoom.PostMessageOrThrow(message);
        }
Exemplo n.º 5
0
        private void Normal(Message incomingChatMessage, Room chatRoom)
        {
            using (var db = new DatabaseContext())
            {
                //get the number of reviews done today by the entire site
                var sa           = new CloseQueueStatsAccessor();
                var stats        = sa.GetOverallQueueStats();
                var totalReviews = db.ReviewedItems.Count(r => r.ReviewedOn.Date == DateTimeOffset.UtcNow.Date);

                if (totalReviews == 0)
                {
                    chatRoom.PostReplyOrThrow(incomingChatMessage, "I don't have enough data to produce those stats.");
                    return;
                }

                var allReviewers    = db.UserPermissions.Count(u => u.PermissionGroup == PermissionGroup.Reviewer);
                var reviewerCount   = db.Users.Count(u => u.ReviewedItems.Any(r => r.ReviewedOn.Date == DateTimeOffset.UtcNow.Date));
                var percentage      = Math.Round(totalReviews * 100D / stats.ReviewsToday, 2);
                var usersPercentage = Math.Round(reviewerCount * 100D / allReviewers);
                var message         = $"{reviewerCount} members ({usersPercentage}% of this room's registered reviewers) have processed {totalReviews} review items, which accounts for {percentage}% of all CV reviews today.";

                chatRoom.PostReplyOrThrow(incomingChatMessage, message);
            }
        }