Exemple #1
0
        public static List <TrackInfoView> CreateFromTrackInfos(List <TrackInfo> trackInfos)
        {
            var trackInfoViews = new List <TrackInfoView>();


            trackInfos.ForEach(trackInfo =>
            {
                var trackInfoView = new TrackInfoView()
                {
                    FileId             = trackInfo.FileId,
                    FileName           = trackInfo.FileName,
                    ProjectName        = trackInfo.ProjectName,
                    ProjectId          = trackInfo.ProjectId,
                    FileType           = trackInfo.FileType,
                    Language           = trackInfo.Language,
                    Efficiency         = trackInfo.ProductivityScore,
                    KeystrokesSaved    = trackInfo.SegmentTrackInfos.Sum(x => x.InsertedCharacters - x.NumberOfKeys < 0 ? 0 : x.InsertedCharacters - x.NumberOfKeys),
                    InsertedCharacters = trackInfo.SegmentTrackInfos.Sum(x => x.InsertedCharacters),
                };
                trackInfoViews.Add(trackInfoView);
            });

            return(trackInfoViews);
        }
        public static List<TrackInfoView> CreateFromTrackInfos(List<TrackInfo> trackInfos)
        {
            var trackInfoViews = new List<TrackInfoView>();


            trackInfos.ForEach(trackInfo =>
            {
                var trackInfoView = new TrackInfoView()
                {
                    FileId = trackInfo.FileId,
                    FileName = trackInfo.FileName,
                    ProjectName = trackInfo.ProjectName,
                    ProjectId = trackInfo.ProjectId,
                    FileType = trackInfo.FileType,
                    Language = trackInfo.Language,
                    Efficiency = trackInfo.ProductivityScore,
                    KeystrokesSaved = trackInfo.SegmentTrackInfos.Sum(x => x.InsertedCharacters - x.NumberOfKeys < 0 ? 0 : x.InsertedCharacters - x.NumberOfKeys),
                    InsertedCharacters = trackInfo.SegmentTrackInfos.Sum(x => x.InsertedCharacters),
                };
                trackInfoViews.Add(trackInfoView);
            });

            return trackInfoViews;
        }