<commit_before>using System;
using System.Data.Entity.Migrations;
using System.Linq;
using BacklogManager.DAL;
using BacklogManager.Models;

namespace BacklogManager.Migrations
{


    internal sealed class Configuration : DbMigrationsConfiguration<BacklogDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = true;
            AutomaticMigrationDataLossAllowed = true;
        }

        protected override void Seed(BacklogDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. 

            var projects = new[]
            {
                new Project{ Color="#FFA62F", Name = "Le Cantaloop"},
                new Project{ Color="#9B59B6", Name = "IE Agents"},
                new Project{ Color="#F39C12", Name = "Bug Funnel"},
                new Project{ Color="#B390D4", Name = "Project Management"},
                new Project{ Color="#F4D03F", Name = "IC productivity"}
            };

            context.Projects.AddOrUpdate(projects);

            var users = new[]
            {
                new User {Username = "oodarichard", Name = "<NAME>", Avatar = "https://pbs.twimg.com/profile_images/573785723758854144/9f2yuFnf_200x200.jpeg", SocialId = 580668794},
                new User{ Username = "smnkhn", Name = "<NAME>", Avatar = "https://pbs.twimg.com/profile_images/571335588016447488/J1d4tDS__200x200.jpeg"},
                new User{ Username = "CollWilliams", Name = "<NAME>", Avatar = "https://pbs.twimg.com/profile_images/439858746936659968/5pVxClm9_200x200.png"},
                new User{ Username = "mgradwohl", Name = "<NAME>", Avatar = "https://pbs.twimg.com/profile_images/1865267615/Xbox_Ring_200x200.jpg"},
                new User{ Username = "thejohnjansen", Name = "<NAME>", Avatar = "https://pbs.twimg.com/profile_images/1110399708/bdayParty_200x200.jpg"}
            };

            context.Users.AddOrUpdate(users);

            var items = new[]
            {
                new BacklogItem { Owner = users[0], Project = projects[0], Upvotes = 15, Discipline = "software engineer", Action = "adopt an effective process", Goal = "I can be more productive"},
                new BacklogItem { Owner = users[1], Project = projects[1], Upvotes = 3, Discipline = "manager", Action = "auto create tasks from deliverables for my ICs", Goal = "I have more time to code"},
                new BacklogItem { Owner = users[2], Project = projects[2], Upvotes = 4, Discipline = "program manager", Action = "see a daily report on bugs in my area path", Goal = "I can calculate my triage rate"},
                new BacklogItem { Owner = users[3], Project = projects[3], Upvotes = 8, Discipline = "developer", Action = "see a breakdown of my time spent on tasks", Goal = "I can identify which tasks takes me longer"},
                new BacklogItem { Owner = users[4], Project = projects[4], Upvotes = 0, Discipline = "developer", Action = "count how many reduction bugs I can delegate", Goal = "I spend more time building features"}
            };


            var rank = 1;
            foreach (var item in items.OrderByDescending(k => k.Upvotes))
            {
                item.CreatedDate = DateTimeOffset.UtcNow;
                item.GlobalRank = rank;
                rank++;

            }

            context.BacklogItems.AddOrUpdate(items);
        }
    }
}<commit_msg>Added check to avoid Seed issues<commit_after>using System;
using System.Data.Entity.Migrations;
using System.Linq;
using BacklogManager.DAL;
using BacklogManager.Models;

namespace BacklogManager.Migrations
{


    internal sealed class Configuration : DbMigrationsConfiguration<BacklogDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = true;
            AutomaticMigrationDataLossAllowed = true;
        }

        protected override void Seed(BacklogDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. 

            if (!context.Projects.Any())
            {

                var projects = new[]
                {
                    new Project {Color = "#FFA62F", Name = "Le Cantaloop"},
                    new Project {Color = "#9B59B6", Name = "IE Agents"},
                    new Project {Color = "#F39C12", Name = "Bug Funnel"},
                    new Project {Color = "#B390D4", Name = "Project Management"},
                    new Project {Color = "#F4D03F", Name = "IC productivity"}
                };

                context.Projects.AddOrUpdate(p => new {p.Color}, projects);
            }

            if (!context.Users.Any())
            {
                var users = new[]
                {
                    new User
                    {
                        Username = "oodarichard",
                        Name = "<NAME>",
                        Avatar = "https://pbs.twimg.com/profile_images/573785723758854144/9f2yuFnf_200x200.jpeg",
                        SocialId = 580668794
                    },
                    new User
                    {
                        Username = "smnkhn",
                        Name = "<NAME>",
                        Avatar = "https://pbs.twimg.com/profile_images/571335588016447488/J1d4tDS__200x200.jpeg"
                    },
                    new User
                    {
                        Username = "CollWilliams",
                        Name = "<NAME>",
                        Avatar = "https://pbs.twimg.com/profile_images/439858746936659968/5pVxClm9_200x200.png"
                    },
                    new User
                    {
                        Username = "mgradwohl",
                        Name = "<NAME>",
                        Avatar = "https://pbs.twimg.com/profile_images/1865267615/Xbox_Ring_200x200.jpg"
                    },
                    new User
                    {
                        Username = "thejohnjansen",
                        Name = "<NAME>",
                        Avatar = "https://pbs.twimg.com/profile_images/1110399708/bdayParty_200x200.jpg"
                    }
                };

                context.Users.AddOrUpdate(u => new {u.Username}, users);
            }

            if (!context.BacklogItems.Any())
            {
                var items = new[]
                {
                    new BacklogItem
                    {
                        Owner = context.Users.Local[0],
                        Project = context.Projects.Local[0],
                        Upvotes = 15,
                        Discipline = "software engineer",
                        Action = "adopt an effective process",
                        Goal = "I can be more productive"
                    },
                    new BacklogItem
                    {
                        Owner = context.Users.Local[1],
                        Project = context.Projects.Local[1],
                        Upvotes = 3,
                        Discipline = "manager",
                        Action = "auto create tasks from deliverables for my ICs",
                        Goal = "I have more time to code"
                    },
                    new BacklogItem
                    {
                        Owner = context.Users.Local[2],
                        Project = context.Projects.Local[2],
                        Upvotes = 4,
                        Discipline = "program manager",
                        Action = "see a daily report on bugs in my area path",
                        Goal = "I can calculate my triage rate"
                    },
                    new BacklogItem
                    {
                        Owner = context.Users.Local[3],
                        Project = context.Projects.Local[3],
                        Upvotes = 8,
                        Discipline = "developer",
                        Action = "see a breakdown of my time spent on tasks",
                        Goal = "I can identify which tasks takes me longer"
                    },
                    new BacklogItem
                    {
                        Owner = context.Users.Local[4],
                        Project = context.Projects.Local[4],
                        Upvotes = 0,
                        Discipline = "developer",
                        Action = "count how many reduction bugs I can delegate",
                        Goal = "I spend more time building features"
                    }
                };


                var rank = 1;
                foreach (var item in items.OrderByDescending(k => k.Upvotes))
                {
                    item.CreatedDate = DateTimeOffset.UtcNow;
                    item.GlobalRank = rank;
                    rank++;

                }

                context.BacklogItems.AddOrUpdate(i => new {i.Discipline, i.Action, i.Goal}, items);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.09445830170263529, 'fraction_numerical': 0.03318512091963995, 'mean_word_length': 1.3388283033223434, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 22, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3009561', 'n_tokens_mistral': 2620, 'n_tokens_neox': 2244, 'n_words': 593}