<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using bootstrap_git_auto_notes.GitClasses;
using RestSharp;
using System.Xml.Linq;
using System.Xml;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using System.IO;


namespace bootstrap_git_auto_notes.Controllers
{
    [Authorize]
    public class HomeController : Controller
    {
        private string clientURL = "https://api.github.com";
        private string username = "<EMAIL>";
        private string password = "<PASSWORD>";
        private string owner = "stephenweaver";
        private string org = "ININServices";

        // Set this to whatever label is going to indicate that a github issue is NOT aa bug/defect
        private string feature_label_name = "enhancement";

        
        public ActionResult Index()
        {
            try
            {
                List<Repository> repositories = GetAllRepositories(clientURL, username, password);
                
                ViewBag.repositories = repositories;

                return View();
            }
            catch (Exception ex)
            {
                return View("Error");
            }
        }

        [HttpPost]
        public ActionResult RepoReleases(string repository)
        {
            try
            {
                List<Release> releases = GetReleases(clientURL, username, password, owner, repository);

                ViewBag.releases = releases;
                ViewBag.repo = repository.Replace(owner + "/", String.Empty);

                return View();
            }
            catch (Exception ex)
            {
                return View("Error");
            }
        }


        [HttpPost]
        public ActionResult ReleaseNotes(string txb_ToRelease, string txb_FromRelease, string repo)
        {
            try
            {
                Label feature_label = new Label();
                List<Release> releases = GetReleases(clientURL, username, password, owner, repo);

                BaseCommit startCommit = GetSingleCommit(clientURL, username, password, owner, repo, txb_FromRelease);
                BaseCommit endCommit = GetSingleCommit(clientURL, username, password, owner, repo, txb_ToRelease);

                List<Milestone> milestones = GetAllMilestones(clientURL, username, password, owner, repo);
                List<Issue> issues = GetAllIssues(clientURL, username, password, owner, repo);
                List<Label> labels = GetLabels(clientURL, username, password, owner, repo);

                foreach (Label label in labels)
                {
                    if (label.name == feature_label_name)
                    {
                        feature_label = label;
                        break;
                    }
                }

                Compare comparison = CompareCommits(clientURL, username, password, owner, repo, startCommit.sha, endCommit.sha);
                List<BaseCommit> commits = GetCommits(clientURL, username, password, owner, repo, null, null, null);

                List<Issue> issues_openANDbelong = new List<Issue>();
                List<Issue> issues_openNOTbelong = new List<Issue>();
                List<Issue> issues_closedNOTbelong = new List<Issue>();
                List<Issue> features_closed = new List<Issue>();

                foreach (Issue issue in issues)
                {
                    if (issue.created_at < endCommit.commit.author.date)
                    {
                        if (issue.state.CompareTo("open") == 0)
                        {
                            if (issue.created_at < startCommit.commit.author.date)
                                if(issue.labels.Contains(feature_label))
                                issues_openNOTbelong.Insert(0, issue);
                            else
                                issues_openANDbelong.Insert(0, issue);
                        }
                        else if (issue.state.CompareTo("closed") == 0)
                        {
                            if (issue.labels.Contains(feature_label) && issue.closed_at < endCommit.commit.author.date)
                            {
                                features_closed.Insert(0, issue);
                            }
                            else<commit_msg>The commit time was off<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using bootstrap_git_auto_notes.GitClasses;
using RestSharp;
using System.Xml.Linq;
using System.Xml;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using System.IO;


namespace bootstrap_git_auto_notes.Controllers
{
    [Authorize]
    public class HomeController : Controller
    {
        private string clientURL = "https://api.github.com";
        private string username = "<EMAIL>";
        private string password = "<PASSWORD>";
        private string owner = "stephenweaver";
        private string org = "ININServices";

        // Set this to whatever label is going to indicate that a github issue is NOT aa bug/defect
        private string feature_label_name = "enhancement";

        
        public ActionResult Index()
        {
            try
            {
                List<Repository> repositories = GetAllRepositories(clientURL, username, password);
                
                ViewBag.repositories = repositories;

                return View();
            }
            catch (Exception ex)
            {
                return View("Error");
            }
        }

        [HttpPost]
        public ActionResult RepoReleases(string repository)
        {
            try
            {
                List<Release> releases = GetReleases(clientURL, username, password, owner, repository);

                ViewBag.releases = releases;
                ViewBag.repo = repository.Replace(owner + "/", String.Empty);

                return View();
            }
            catch (Exception ex)
            {
                return View("Error");
            }
        }


        [HttpPost]
        public ActionResult ReleaseNotes(string txb_ToRelease, string txb_FromRelease, string repo)
        {
            try
            {
                Label feature_label = new Label();
                List<Release> releases = GetReleases(clientURL, username, password, owner, repo);

                BaseCommit startCommit = GetSingleCommit(clientURL, username, password, owner, repo, txb_FromRelease);
                BaseCommit endCommit = GetSingleCommit(clientURL, username, password, owner, repo, txb_ToRelease);

                List<Milestone> milestones = GetAllMilestones(clientURL, username, password, owner, repo);
                List<Issue> issues = GetAllIssues(clientURL, username, password, owner, repo);
                List<Label> labels = GetLabels(clientURL, username, password, owner, repo);

                foreach (Label label in labels)
                {
                    if (label.name == feature_label_name)
                    {
                        feature_label = label;
                        break;
                    }
                }

                Compare comparison = CompareCommits(clientURL, username, password, owner, repo, startCommit.sha, endCommit.sha);
                List<BaseCommit> commits = GetCommits(clientURL, username, password, owner, repo, null, null, null);

                List<Issue> issues_openANDbelong = new List<Issue>();
                List<Issue> issues_openNOTbelong = new List<Issue>();
                List<Issue> issues_closedNOTbelong = new List<Issue>();
                List<Issue> features_closed = new List<Issue>();
                // This commit is acting funny
                foreach (Issue issue in issues)
                {
                    if (issue.created_at < endCommit.commit.author.date)
                    {
                        if (issue.state.CompareTo("open") == 0)
                        {
                            if (issue.created_at < startCommit.commit.author.date)
                                if(issue.labels.Contains(feature_label))
                                issues_openNOTbelong.Insert(0, issue);
                            else
                                issues_openANDbelong.Insert(0, issue);
                        }
                        else if (issue.state.CompareTo("closed") == 0)
                        {
                            if (issue.labels.Contains(feature_label) && issue.closed_at < endCommit.commit.author.date)
                            {
                                features_closed.Insert(0, issue);
                            }
                            else
{'fraction_non_alphanumeric': 0.08273381294964029, 'fraction_numerical': 0.0011241007194244604, 'mean_word_length': 1.5595512082853855, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 37, 'https://': 2, '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': '4149226', 'n_tokens_mistral': 2209, 'n_tokens_neox': 2062, 'n_words': 512}