<commit_before>﻿namespace DotNetRu.Clients.Portable.ViewModel
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;
    using System.Windows.Input;

    using DotNetRu.DataStore.Audit.Models;
    using DotNetRu.DataStore.Audit.Services;
    using DotNetRu.Utils.Helpers;

    using FormsToolkit;

    using MvvmHelpers;

    using Xamarin.Forms;

    public class SpeakersViewModel : ViewModelBase
    {
        public SpeakersViewModel(INavigation navigation)
            : base(navigation)
        {
        }

        public ObservableRangeCollection<Grouping<char, SpeakerModel>> speakers = new ObservableRangeCollection<Grouping<char, SpeakerModel>>();
        public ObservableCollection<Grouping<char, SpeakerModel>> Speakers => speakers;

        #region Sorting

        private void SortSpeakers(IEnumerable<SpeakerModel> speakers)
        {
            var speakersSorted = from speaker in speakers 
                                    orderby speaker.FirstName 
                                    group speaker by Char.ToUpperInvariant(speaker.FirstName[0]) into speakerGroup
                                    select new Grouping<char, SpeakerModel>(speakerGroup.Key, speakerGroup);

            this.speakers.ReplaceRange(speakersSorted);
        }

        #endregion<commit_msg>russian names are on top, english names in the bottom #203<commit_after>﻿namespace DotNetRu.Clients.Portable.ViewModel
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;
    using System.Windows.Input;

    using DotNetRu.DataStore.Audit.Models;
    using DotNetRu.DataStore.Audit.Services;
    using DotNetRu.Utils.Helpers;

    using FormsToolkit;

    using MvvmHelpers;

    using Xamarin.Forms;

    public class SpeakersViewModel : ViewModelBase
    {
        public SpeakersViewModel(INavigation navigation)
            : base(navigation)
        {
        }

        public ObservableRangeCollection<Grouping<char, SpeakerModel>> speakers = new ObservableRangeCollection<Grouping<char, SpeakerModel>>();
        public ObservableCollection<Grouping<char, SpeakerModel>> Speakers => speakers;

        #region Sorting

        private void SortSpeakers(IEnumerable<SpeakerModel> speakers)
        {            
            var speakersSorted = speakers.Select(speaker => new { speaker, firstChar = Char.ToUpperInvariant(speaker.FirstName[0])})
                                         .OrderBy(s => 'A' <= s.firstChar && s.firstChar <= 'Z') //english names in the bottom
                                         .ThenBy(s => s.speaker.FirstName)
                                         .GroupBy(s => s.firstChar)
                                         .Select(g => new Grouping<char, SpeakerModel>(g.Key, g.Select(s => s.speaker)));

            this.speakers.ReplaceRange(speakersSorted);
        }

        #endregion
{'fraction_non_alphanumeric': 0.08192852326365475, 'fraction_numerical': 0.0016857720836142953, 'mean_word_length': 2.3076923076923075, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7242552', 'n_tokens_mistral': 794, 'n_tokens_neox': 744, 'n_words': 159}