Ejemplo n.º 1
0
        public static void ResetTimeResultsfromJson(sc2dsstatsContext context, ILogger logger)
        {
            var results = JsonSerializer.Deserialize <List <DsTimeResultValue> >(File.ReadAllText("/data/results.json"));

            logger.LogInformation($"Got {results.Count} from json file.");

            var timeresults = context.DsTimeResults.ToList();

            timeresults.ForEach(f => { f.Count = 0; f.Wins = 0; f.MVP = 0; f.Duration = 0; f.Kills = 0; f.Army = 0; });
            context.SaveChanges();

            var participants = context.Participants.ToList();

            participants.ForEach(f => { f.Count = 0; f.Wins = 0; });
            context.SaveChanges();

            UploadService.CollectTimeResults2(context, logger, results);
        }
Ejemplo n.º 2
0
        public static void SetMengskTestReplaysDefaultToFalse(sc2dsstatsContext context)
        {
            var replays     = ReplayFilter.DefaultFilter(context);
            var testReplays = from r in replays
                              from p in r.Dsplayers
                              where p.Race == (byte)DSData.Commander.Mengsk && r.Gametime < new DateTime(2020, 07, 28, 5, 23, 0)
                              select r;

            foreach (var replay in testReplays)
            {
                replay.DefaultFilter = false;
            }
            context.SaveChanges();
        }