<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

using Brew.Utilities;

namespace Brew.ViewModels.Recipes
{
    public class RecipesViewModel : BaseLayoutViewModel
    {
        public string SortBy { get; set; }

        public readonly PagedList<BeerSummaryViewModel> Beers;

        public RecipesViewModel(uint pageNo)
        {
            SortBy = "hoppin";
            var allBeers = new List<BeerSummaryViewModel>();
            using (var context = new Models.ModelsContext())
            {
                var dbModel = (from r in context.Recipes.Include(p => p.Style) select r);
                foreach (var recipie in dbModel)
                {                     
                    allBeers.Add(new BeerSummaryViewModel
                    {
                        Abv = BrewCharacteristicAlgs.CalculateABV(recipie.OG, recipie.FG),                                 // from equation
                        AvgRating = (decimal)recipie.TasteRating, // average of all votes
                        SiteRating = (decimal)recipie.SiteRating, 
                        Color = recipie.Efficiency,
                        Id = 1,
                        Name = recipie.Name,
                        Style = recipie.Style.Name,
                        User = "McGroober"
                    });
                }
            }

            Beers = new PagedList<BeerSummaryViewModel>(allBeers.GetRange((int)(pageNo * 30), (int)Math.Min(allBeers.Count, pageNo * 30 + 30)), allBeers.Count < 30 ? 0 : (uint)Math.Ceiling(allBeers.Count / 30d), pageNo, 30);
        }     
    }
}<commit_msg>Mini-commit to round ABV values to 2 decimal places.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

using Brew.Utilities;

namespace Brew.ViewModels.Recipes
{
    public class RecipesViewModel : BaseLayoutViewModel
    {
        public string SortBy { get; set; }

        public readonly PagedList<BeerSummaryViewModel> Beers;

        public RecipesViewModel(uint pageNo)
        {
            SortBy = "hoppin";
            var allBeers = new List<BeerSummaryViewModel>();
            using (var context = new Models.ModelsContext())
            {
                var dbModel = (from r in context.Recipes.Include(p => p.Style) select r);
                foreach (var recipie in dbModel)
                {                     
                    allBeers.Add(new BeerSummaryViewModel
                    {
                        Abv = Math.Round(BrewCharacteristicAlgs.CalculateABV(recipie.OG, recipie.FG), 2),   // from equation
                        AvgRating = (decimal)recipie.TasteRating, // average of all votes
                        SiteRating = (decimal)recipie.SiteRating, 
                        Color = recipie.Efficiency,
                        Id = 1,
                        Name = recipie.Name,
                        Style = recipie.Style.Name,
                        User = "McGroober"
                    });
                }
            }

            Beers = new PagedList<BeerSummaryViewModel>(allBeers.GetRange((int)(pageNo * 30), (int)Math.Min(allBeers.Count, pageNo * 30 + 30)), allBeers.Count < 30 ? 0 : (uint)Math.Ceiling(allBeers.Count / 30d), pageNo, 30);
        }     
    }
}
{'fraction_non_alphanumeric': 0.09015421115065243, 'fraction_numerical': 0.008896797153024912, 'mean_word_length': 1.5495086923658352, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6712474', 'n_tokens_mistral': 975, 'n_tokens_neox': 867, 'n_words': 199}