Beispiel #1
0
 public ThresholdMultiLineChart GetRedundantChart()
 {
     return(new ThresholdMultiLineChart()
     {
         Id = "redundant_chart",
         XAxis = "Submission #",
         YAxis = "# Redundant Tests",
         Minimum = new ChartPoint()
         {
             X = 1,
             Y = 0,
         },
         Maximum = new ChartPoint()
         {
             X = Submissions.Count,
             Y = 100,
         },
         Lines = new List <ThresholdMultiLineChartLine>()
         {
             new ThresholdMultiLineChartLine()
             {
                 Label = "Redundant Tests Line",
                 Color = "#007bff",
                 Points = Submissions.Select((s, x) => new ChartPoint()
                 {
                     X = x + 1,
                     Y = CalculateSubmissionRedundancyPercentage(s),
                 }).ToList(),
             }
         },
         ThresholdLine = new ThresholdMultiLineChartLine()
         {
             Color = "#28a745",
             Label = "Max",
             Points = Enumerable.Repeat(0, Submissions.Count)
                      .Select((_, x) => new ChartPoint()
             {
                 X = x + 1,
                 Y = RedundantTestLevel
             }).ToList()
         },
         MarkColor = "#dc3545",
         XMark = Index + 1
     });
 }
Beispiel #2
0
 private ThresholdMultiLineChartLine GetThresholdMultiLineChartLine(string label, string color,
                                                                    Func <Submission, double> progressFunction)
 {
     return(new ThresholdMultiLineChartLine()
     {
         Label = label,
         Color = color,
         Points = Submissions.Select((s, x) =>
                                     (s.Feedback == null || s.Feedback.EngineException != null)
             ? new ChartPoint()
         {
             X = x + 1,
             Y = 0,
         } :
                                     new ChartPoint()
         {
             X = x + 1,
             Y = progressFunction(s)
         }).ToList()
     });
 }
Beispiel #3
0
        public async void Check()
        {
            if (!CanCheck())
            {
                return;
            }

            IsRunning = true;
            try
            {
                await Task.Run(() =>
                {
                    var watch    = Stopwatch.StartNew();
                    var comparer = new Comparer(Configuration, (IProgressReporter)this);

                    AddMessage(string.Format("Comparing {0} files ", Submissions.Count));
                    var compareResult = comparer.Compare(Submissions.Select(i => i.Submission).ToArray());
                    AddMessage(string.Format("  finished; time: {0:n2} sec.", watch.Elapsed.TotalSeconds));

                    AddMessage("Creating statistics");
                    var result  = OSPCResult.Create(compareResult);
                    var friends = new OSPC.FriendFinder(Configuration);
                    friends.Find(result, compareResult);
                    AddMessage(string.Format("  finished; time: {0:n2} sec.", watch.Elapsed.TotalSeconds));

                    AddMessage("Creating reports");
                    var html = new OSPC.Reporter.Html.HtmlReporter(HtmlReportPath, (IProgressReporter)this);
                    html.Create(this.Configuration, result);
                    System.Diagnostics.Process.Start(System.IO.Path.Combine(html.OutPath, "index.html"));
                    AddMessage(string.Format("  finished in total {0:n2} sec.", watch.Elapsed.TotalSeconds));

                    SaveUserSettings();
                });
            }
            finally
            {
                IsRunning = false;
            }
        }