<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using AThousandCounts.Models;
using System.Data.Entity;

namespace AThousandCounts.Controllers
{
    public class CountController : Controller
    {
        CountContext db;

        public CountController()
        {
            this.db = new CountContext();
        }

        public ActionResult Index()
        {
            var ipAddress = System.Web.HttpContext.Current.Request.UserHostName;
            int oldNumber;
            if (CheckIpAddress(ipAddress, out oldNumber))
            {
                ViewBag.BeenAround = oldNumber;
                return View(-1);
            }

            var r = new Random();
            var number = 0;
            var counts = db.Counts.Where(c => c.Completed == false).ToList();
            var countsLeft = counts.Count();

            if (countsLeft > 0)
            {
                number = counts.ElementAt(r.Next(1, countsLeft)).Count;
            }

            ViewBag.CountsLeft = countsLeft - 1;
            return View(number);<commit_msg>Counting in order<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using AThousandCounts.Models;
using System.Data.Entity;

namespace AThousandCounts.Controllers
{
    public class CountController : Controller
    {
        CountContext db;

        public CountController()
        {
            this.db = new CountContext();
        }

        public ActionResult Index()
        {
            var ipAddress = System.Web.HttpContext.Current.Request.UserHostName;
            int oldNumber;
            if (CheckIpAddress(ipAddress, out oldNumber))
            {
                ViewBag.BeenAround = oldNumber;
                return View(-1);
            }

            var r = new Random();
            var number = 0;
            var counts = db.Counts.Where(c => c.Completed == false).ToList();
            var countsLeft = counts.Count();

            if (countsLeft > 0)
            {
                number = counts.First().Count;
                //counts.ElementAt(r.Next(1, countsLeft)).Count;
            }

            ViewBag.CountsLeft = countsLeft - 1;
            return View(number);
{'fraction_non_alphanumeric': 0.09566326530612244, 'fraction_numerical': 0.004251700680272109, 'mean_word_length': 1.7682352941176471, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3739919', 'n_tokens_mistral': 641, 'n_tokens_neox': 619, 'n_words': 144}