<commit_before>﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DiplomContentSystem.Dto;
using DiplomContentSystem.Core;
namespace DiplomContentSystem.Services
{
    public class MappingProfile : Profile
    {
        public MappingProfile()
        {
            CreateMap<Teacher, TeacherListItem>()
                .ForMember(item => item.Speciality, opt => opt.MapFrom(src => (src.Speciality!=null)?src.Speciality.ShortName:null))
                .ForMember(item => item.Position, opt => opt.MapFrom(src => (src.Position!=null)?src.Position.Name:null));
            CreateMap<TeacherEditItem, Teacher>()
                .ForMember(item=>item.Id, opt=>opt.MapFrom(src=>src.Id==null?0:src.Id))
                .ForMember(item=>item.PositionId,opt=>opt.MapFrom(src=>src.PositionId))
                .ForMember(item=>item.SpecialityId, opt=>opt.UseValue(1))
                .ForMember(item=>item.Position, opt=>opt.Ignore())
                .ForMember(item=>item.Speciality, opt=>opt.Ignore());

            CreateMap<Student, StudentListItem>()
                .ForMember(item => item.DiplomWork, opt => opt.MapFrom(src => (src.DiplomWork!=null)?src.DiplomWork.Name:null))
                .ForMember(item => item.Group, opt => opt.MapFrom(src => (src.Group!=null)?src.Group.Name:null))
                .ForMember(item => item.Teacher, opt => opt.MapFrom(src => (src.Teacher!=null)?src.Teacher.FIO:null));
        }
    }
}<commit_msg>DCS-10: new Profile for DiplomWorkListItem. FIx Formatting<commit_after>﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DiplomContentSystem.Dto;
using DiplomContentSystem.Core;
namespace DiplomContentSystem.Services
{
    public class MappingProfile : Profile
    {
        public MappingProfile()
        {
            CreateMap<Teacher, TeacherListItem>()
                .ForMember(item => item.Speciality, opt => opt.MapFrom(src => (src.Speciality != null) ? src.Speciality.ShortName : null))
                .ForMember(item => item.Position, opt => opt.MapFrom(src => (src.Position != null) ? src.Position.Name : null));
            CreateMap<TeacherEditItem, Teacher>()
                .ForMember(item => item.Id, opt => opt.MapFrom(src => src.Id == null ? 0 : src.Id))
                .ForMember(item => item.PositionId, opt => opt.MapFrom(src => src.PositionId))
                .ForMember(item => item.SpecialityId, opt => opt.UseValue(1))
                .ForMember(item => item.Position, opt => opt.Ignore())
                .ForMember(item => item.Speciality, opt => opt.Ignore());

            CreateMap<Student, StudentListItem>()
                .ForMember(item => item.DiplomWork, opt => opt.MapFrom(src => (src.DiplomWork != null) ? src.DiplomWork.Name : null))
                .ForMember(item => item.Group, opt => opt.MapFrom(src => (src.Group != null) ? src.Group.Name : null))
                .ForMember(item => item.Teacher, opt => opt.MapFrom(src => (src.Teacher != null) ? src.Teacher.FIO : null));

            CreateMap<DiplomWork, DiplomWorkListItem>()
                .ForMember(item => item.Teacher, opt => opt.MapFrom(src => (src.Teacher != null) ? src.Teacher.FIO : null));
        }
    }
}
{'fraction_non_alphanumeric': 0.15012106537530268, 'fraction_numerical': 0.0018159806295399517, 'mean_word_length': 2.820809248554913, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2396813', 'n_tokens_mistral': 1014, 'n_tokens_neox': 982, 'n_words': 171}