<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PlatformStatusTracker.Core.Data;
using PlatformStatusTracker.Core.Repository;

namespace PlatformStatusTracker.Core.Model
{
    public class ChangeSet
    {
        /// <summary>
        /// Status changed at date.
        /// </summary>
        public DateTime Date { get; set; }

        /// <summary>
        /// List of changed statuses.
        /// </summary>
        public ChangeInfo[] Changes { get; set; }

        public static ChangeSet[] GetChangeSetsFromPlatformStatuses(PlatformStatuses[] platformStatuses)
        {
            return Enumerable.Range(0, platformStatuses.Length - 1)
                             .Select(x => new { New = platformStatuses[x], Old = platformStatuses[x + 1] })
                             .Select(x => new ChangeSet() { Date = x.New.Date, Changes = PlatformStatusTracking.GetChangeInfoSetFromStatuses(x.Old.Statuses, x.New.Statuses) })
                             .ToArray();<commit_msg>Ignore errors at the moment<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PlatformStatusTracker.Core.Data;
using PlatformStatusTracker.Core.Repository;

namespace PlatformStatusTracker.Core.Model
{
    public class ChangeSet
    {
        /// <summary>
        /// Status changed at date.
        /// </summary>
        public DateTime Date { get; set; }

        /// <summary>
        /// List of changed statuses.
        /// </summary>
        public ChangeInfo[] Changes { get; set; }

        public static ChangeSet[] GetChangeSetsFromPlatformStatuses(PlatformStatuses[] platformStatuses)
        {
            // FIXME: We must handle unexpected errors.
            return Enumerable.Range(0, platformStatuses.Length - 1)
                             .Select(x => new { New = platformStatuses[x], Old = platformStatuses[x + 1] })
                             .Select(x =>
                             {
                                 try
                                 {
                                     return new ChangeSet()
                                     {
                                         Date = x.New.Date,
                                         Changes =
                                             PlatformStatusTracking.GetChangeInfoSetFromStatuses(x.Old.Statuses,
                                                 x.New.Statuses)
                                     };
                                 }
                                 catch (Exception)
                                 {
                                     return null;
                                 }
                             })
                             .Where(x => x != null)
                             .ToArray();
{'fraction_non_alphanumeric': 0.08921805029280055, 'fraction_numerical': 0.0020668274199104374, 'mean_word_length': 1.2201834862385321, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3633610', 'n_tokens_mistral': 651, 'n_tokens_neox': 641, 'n_words': 150}