<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using DragonContracts.Base;
using DragonContracts.Models;
using Raven.Client;

namespace DragonContracts.Controllers
{
    public class ContractsController : DragonContractsController
    {
        // GET api/values
        public async Task<IList<Contract>> Get()
        {
            if (await Session.Query<Contract>().AnyAsync() == false)
            {
                for (int i = 0; i < 10; i++)
                {
                    var address = new Address()
                    {
                        City = "City" + i,
                        Number = i.ToString(),
                        Street = "Street" + i,
                        ZipCode = i.ToString()
                    };

                    var firstContact = new Contact()
                    {
                        Address = address,
                        Name = "first " + i
                    };

                    var secondContact = new Contact()
                    {
                        Address = address,
                        Name = "Second " + i
                    };

                    var contract = new Contract()
                    {
                        Id = i.ToString(),
                        FirstParty = firstContact,
                        SecondParty = secondContact,
                        Price = i * 10,
                        SignedOn = DateTime.Now.AddDays(-1 * i),
                        Subject = "Subject " + i
                    };

                    await Session.StoreAsync(contract, i.ToString());
                    await Session.SaveChangesAsync();
                }
            }

            var result = Session.Query<Contract>().ToListAsync();

            return await result;
        }

        // GET api/values/5
        public async Task<IList<Contract>> Get(string filter)
        {
            //todo: filter by subject, contact names now just return all
            return await Session.Query<Contract>().ToListAsync();<commit_msg>Disable with comment AddTestData<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using DragonContracts.Base;
using DragonContracts.Models;
using Raven.Client;

namespace DragonContracts.Controllers
{
    public class ContractsController : DragonContractsController
    {
        // GET api/values
        public async Task<IList<Contract>> Get()
        {
            //await AddTestData();

            var result = Session.Query<Contract>().ToListAsync();

            return await result;
        }

        private async Task AddTestData()
        {
            if (await Session.Query<Contract>().AnyAsync() == false)
            {
                for (int i = 0; i < 10; i++)
                {
                    var address = new Address()
                    {
                        City = "City" + i,
                        Number = i.ToString(),
                        Street = "Street" + i,
                        ZipCode = i.ToString()
                    };

                    var firstContact = new Contact()
                    {
                        Address = address,
                        Name = "first " + i
                    };

                    var secondContact = new Contact()
                    {
                        Address = address,
                        Name = "Second " + i
                    };

                    var contract = new Contract()
                    {
                        Id = i.ToString(),
                        FirstParty = firstContact,
                        SecondParty = secondContact,
                        Price = i*10,
                        SignedOn = DateTime.Now.AddDays(-1*i),
                        Subject = "Subject " + i
                    };

                    await Session.StoreAsync(contract, i.ToString());
                    await Session.SaveChangesAsync();
                }
            }
        }

        // GET api/values/5
        public async Task<IList<Contract>> Get(string filter)
        {
            //todo: filter by subject, contact names now just return all
            return await Session.Query<Contract>().ToListAsync();
{'fraction_non_alphanumeric': 0.0884736605132823, 'fraction_numerical': 0.0031517334533993696, 'mean_word_length': 1.100709219858156, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '6001172', 'n_tokens_mistral': 1053, 'n_tokens_neox': 965, 'n_words': 256}