<commit_before>﻿using BatteryCommander.Web.Models.Reports;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;

namespace BatteryCommander.Web.Models
{
    public partial class Unit
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        public String Name { get; set; }

        public String UIC { get; set; }

        public Boolean IgnoreForReports { get; set; }

        public virtual ICollection<Soldier> Soldiers { get; set; }

        public virtual ICollection<Vehicle> Vehicles { get; set; }

        [NotMapped]
        public virtual IEnumerable<Soldier> CLS
        {
            get { return Soldiers?.Where(soldier => soldier.ClsQualified).OrderBy(soldier => soldier.LastName).ThenBy(soldier => soldier.FirstName); }
        }

        [NotMapped]
        public virtual IEnumerable<Row> SSD
        {
            get
            {
                return
                    RankExtensions
                    .All()
                    .Where(rank => rank.IsEnlisted() || rank.IsNCO())
                    .Select(rank => new Row
                    {
                        Rank = rank,
                        Assigned = Soldiers.Where(soldier => soldier.Rank == rank).Count(),
                        Completed = Soldiers.Where(soldier => soldier.Rank == rank).Where(soldier => soldier.SSDStatus.CurrentProgress >= Decimal.One).Count()<commit_msg>Another attempt to fix null ref on create<commit_after>﻿using BatteryCommander.Web.Models.Reports;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;

namespace BatteryCommander.Web.Models
{
    public partial class Unit
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        public String Name { get; set; }

        public String UIC { get; set; }

        public Boolean IgnoreForReports { get; set; }

        public virtual ICollection<Soldier> Soldiers { get; set; } = new List<Soldier>();

        public virtual ICollection<Vehicle> Vehicles { get; set; } = new List<Vehicle>();

        [NotMapped]
        public virtual IEnumerable<Soldier> CLS
        {
            get { return Soldiers.Where(soldier => soldier.ClsQualified).OrderBy(soldier => soldier.LastName).ThenBy(soldier => soldier.FirstName); }
        }

        [NotMapped]
        public virtual IEnumerable<Row> SSD
        {
            get
            {
                return
                    RankExtensions
                    .All()
                    .Where(rank => rank.IsEnlisted() || rank.IsNCO())
                    .Select(rank => new Row
                    {
                        Rank = rank,
                        Assigned = Soldiers.Where(soldier => soldier.Rank == rank).Count(),
                        Completed = Soldiers.Where(soldier => soldier.Rank == rank).Where(soldier => soldier.SSDStatus.CurrentProgress >= Decimal.One).Count()
{'fraction_non_alphanumeric': 0.09914475768134305, 'fraction_numerical': 0.0, 'mean_word_length': 2.0423892100192678, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 31, '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': '6701755', 'n_tokens_mistral': 852, 'n_tokens_neox': 805, 'n_words': 190}