<commit_before>﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using Community.Models;
using Community.Models.ViewModels;

namespace Community.Controllers
{
    public class HomeController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: Home
        public ActionResult Index()
        {
            HomeViewModel home = new HomeViewModel();
            home.email = "<EMAIL>";
            home.lastLogin = DateTime.Today;
            home.loginsLastMonth = 1339;
            home.unreadMessages = 1337;
            return View(home);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}
<commit_msg>Home kan räkna olästa meddelanden<commit_after>﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using Community.Models;
using Community.Models.ViewModels;
using Microsoft.AspNet.Identity;

namespace Community.Controllers
{
    [Authorize]
    public class HomeController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: Home
        public ActionResult Index()
        {
            ApplicationUser user = db.Users.Find(User.Identity.GetUserId());

            HomeViewModel home = new HomeViewModel();
            home.email = user.Email;
            home.lastLogin = user.lastLogin;
            home.loginsLastMonth = user.loginMonthCounter;
            home.unreadMessages = db.ReadEntries.Where(r => r.Receiver.Equals(user.Id)&&r.Active&&r.FirstReadTime==null).Count();
            return View(home);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}

{'fraction_non_alphanumeric': 0.0945945945945946, 'fraction_numerical': 0.003727865796831314, 'mean_word_length': 2.171344165435746, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, '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': '5005223', 'n_tokens_mistral': 582, 'n_tokens_neox': 571, 'n_words': 129}