private string GenerateRequestParams(DateRange range)
        {
            var since = DateFunctions.AsIso8601Date(range.Start);
            var until = DateFunctions.AsIso8601Date(range.End);

            var resultParams = $"since={since}&until={until}&time_zone=UTC&total=true";
            var ids          = _parameters.Services.Split(',');

            foreach (var id in ids)
            {
                resultParams += $"&service_ids[]={id}";
            }
            return(resultParams);
        }
Exemplo n.º 2
0
        private static async Task ReadWeekends(IncidentCounter incidentCounter, DateRange range)
        {
            var lines = new List <string>();

            while (range.End <= DateTime.Today)
            {
                var count = await incidentCounter.CountIncidents(range);

                Console.WriteLine($"Count at {range} is {count}");
                var startDate = DateFunctions.AsIso8601Date(range.Start);
                lines.Add($"{startDate}, {count}");

                range = DateFunctions.NextWeekend(range);
            }

            File.WriteAllLines("out.txt", lines);
        }