Пример #1
0
        private static void HandleVirtualJudgeProblems(
            QueryWorkerHistory worker,
            CrawlerSummaryData vjSummary,
            IReadOnlyDictionary <string, CrawlerSummaryData> summaries)
        {
            foreach (var problem in worker.SolvedList)
            {
                var(problemCrawlerName, problemId)
                    = problem.Split('-');

                if (summaries.TryGetValue(problemCrawlerName,
                                          out var problemCrawlerSummary))
                {
                    problemCrawlerSummary.Usernames.Add(new UsernameInCrawler
                    {
                        Username        = worker.Username,
                        FromCrawlerName = worker.CrawlerName,
                    });
                    problemCrawlerSummary.SolvedSet.Add(problemId);
                }
                else
                {
                    vjSummary.SolvedSet.Add(problem);
                }
            }
        }
Пример #2
0
        private static void HandleVirtualJudgeSubmissions(
            QueryWorkerHistory worker,
            CrawlerSummaryData vjSummary,
            IReadOnlyDictionary <string, CrawlerSummaryData> summaries)
        {
            foreach (var(crawler, submissions) in worker.SubmissionsByCrawlerName)
            {
                if (summaries.TryGetValue(crawler, out var crawlerSummary))
                {
                    crawlerSummary.Submissions += submissions;

                    crawlerSummary.Usernames.Add(new UsernameInCrawler
                    {
                        Username        = worker.Username,
                        FromCrawlerName = worker.CrawlerName == crawler
                            ? null
                            : worker.CrawlerName,
                    });
                }
                else
                {
                    vjSummary.NotMergedSubmissions += submissions;
                }
            }
        }
Пример #3
0
        private static string GetCrawlerTitle(
            IReadOnlyCollection <CrawlerMetaItem> crawlerMeta,
            QueryWorkerHistory history)
        {
            var meta = crawlerMeta.First(item => item.CrawlerName == history.CrawlerName);

            return(meta.CrawlerTitle);
        }