<commit_before>﻿namespace Showcase.Services.Data
{
    using System;
    using System.Linq;

    using Showcase.Data.Common.Models;
    using Showcase.Data.Common.Repositories;
    using Showcase.Data.Models;
    using Showcase.Services.Common;
    using Showcase.Services.Data.Contracts;

    public class StatisticsService : IStatisticsService
    {
        private readonly IRepository<Project> projects;
        private readonly IRepository<Tag> tags;
        private readonly IRepository<User> users;

        public StatisticsService(IRepository<Project> projects, IRepository<Tag> tags, IRepository<User> users)
        {
            this.projects = projects;
            this.tags = tags;
            this.users = users;
        }

        public IQueryable<IGrouping<int, Project>> Current()
        {
            return this.projects
                .All()
                .GroupBy(pr => 0); // Don't ask!
        }

        public IQueryable<IGrouping<int, Project>> ProjectsLastSixMonths()
        {
            var todaySixMonthsAgo = DateTime.Now.AddMonths(-6);
            
            return this.projects
                .All()
                .Where(p => p.CreatedOn >= todaySixMonthsAgo && !p.Collaborators.Any(c => c.IsAdmin))
                .GroupBy(s => s.CreatedOn.Month)
                .OrderBy(gr => gr.Key);
        }
        
        public IQueryable<Tag> ProjectsCountByTag()
        {
            return this.tags
                .All()
                .Where(t => t.Type != TagType.Season)
                .OrderByDescending(t => t.Projects.Count)
                .Take(Constants.StatisticsTopTagsCount);
        }
        
        public IQueryable<Project> TopProjects()
        {
            return this.projects
                .All()
                .Where(p => !p.Collaborators.Any(c => c.IsAdmin))<commit_msg>Projects last six months now include projects by admins. Closes #137<commit_after>﻿namespace Showcase.Services.Data
{
    using System;
    using System.Linq;

    using Showcase.Data.Common.Models;
    using Showcase.Data.Common.Repositories;
    using Showcase.Data.Models;
    using Showcase.Services.Common;
    using Showcase.Services.Data.Contracts;

    public class StatisticsService : IStatisticsService
    {
        private readonly IRepository<Project> projects;
        private readonly IRepository<Tag> tags;
        private readonly IRepository<User> users;

        public StatisticsService(IRepository<Project> projects, IRepository<Tag> tags, IRepository<User> users)
        {
            this.projects = projects;
            this.tags = tags;
            this.users = users;
        }

        public IQueryable<IGrouping<int, Project>> Current()
        {
            return this.projects
                .All()
                .GroupBy(pr => 0); // Don't ask!
        }

        public IQueryable<IGrouping<int, Project>> ProjectsLastSixMonths()
        {
            var todaySixMonthsAgo = DateTime.Now.AddMonths(-6);
            
            return this.projects
                .All()
                .Where(p => p.CreatedOn >= todaySixMonthsAgo)
                .GroupBy(s => s.CreatedOn.Month)
                .OrderBy(gr => gr.Key);
        }
        
        public IQueryable<Tag> ProjectsCountByTag()
        {
            return this.tags
                .All()
                .Where(t => t.Type != TagType.Season)
                .OrderByDescending(t => t.Projects.Count)
                .Take(Constants.StatisticsTopTagsCount);
        }
        
        public IQueryable<Project> TopProjects()
        {
            return this.projects
                .All()
                .Where(p => !p.Collaborators.Any(c => c.IsAdmin))
{'fraction_non_alphanumeric': 0.09911123081066522, 'fraction_numerical': 0.0018852679773767843, 'mean_word_length': 1.740959409594096, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 46, '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': '2367080', 'n_tokens_mistral': 1040, 'n_tokens_neox': 989, 'n_words': 199}