Skip to content

Commit

Permalink
Addressed all of the concerns in the email from James.
Browse files Browse the repository at this point in the history
(1) Moved amount, time, and amountIsWeight to there corresponding join tables.
(2) Created a join table called HopSubstitute that has two columns which are both keys - recipe name and hop name.
(3). Added the constraint for Rating_Score to the Constraints.sql.

Deleted the webpages_OAuthMembership
Deleted the webpages_Roles
Deleted the webpages_UserProfile_Roles

Report-
Added section describing the webpages_Membership.
Added section describing login and user management.
Added section for the meetings minutes. (James I put this as a table in the document but feel free to format it differently.)

James and Michael please feel free to update the minutes with anything you remember that I left out.
  • Loading branch information
Eliminator123 committed Apr 14, 2013
1 parent b6ee011 commit f57d4fa
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 43 deletions.
Binary file modified Brew/Brew/App_Data/aspnet-Brew-20130213151837.mdf
Binary file not shown.
Binary file modified Brew/Brew/App_Data/aspnet-Brew-20130213151837_log.ldf
Binary file not shown.
1 change: 1 addition & 0 deletions Brew/Brew/Brew.csproj
Expand Up @@ -175,6 +175,7 @@
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Models\AccountModels.cs" />
<Compile Include="Models\CommentsModels.cs" />
<Compile Include="Models\HopSubstituteModel.cs" />
<Compile Include="Models\RatingsModels.cs" />
<Compile Include="Models\FermentableModels.cs" />
<Compile Include="Models\HopModels.cs" />
Expand Down
35 changes: 22 additions & 13 deletions Brew/Brew/DBGeneration/BrewXMLParser.cs
Expand Up @@ -16,7 +16,7 @@ public class BrewXMLParser
//
// GET: /DB/

public Models.Yeast ParseYeasts(XmlTextReader reader, ref bool AddToSecondary)
public Models.Yeast ParseYeasts(XmlTextReader reader, ref bool AddToSecondary, ref float Amount, ref bool AmoutIsWeight)
{
Models.Yeast yeast = new Models.Yeast();
var currentNodeName = "";
Expand Down Expand Up @@ -58,10 +58,10 @@ public Models.Yeast ParseYeasts(XmlTextReader reader, ref bool AddToSecondary)
yeast.YeastForm_Name = reader.Value;
break;
case "AMOUNT":
yeast.Amount = float.Parse(reader.Value);
Amount = float.Parse(reader.Value);
break;
case "AMOUNT_IS_WEIGHT":
yeast.AmoutIsWeight = bool.Parse(reader.Value);
AmoutIsWeight = bool.Parse(reader.Value);
break;
case "LABORATORY":
yeast.Laboratory = reader.Value;
Expand Down Expand Up @@ -109,7 +109,7 @@ public Models.Yeast ParseYeasts(XmlTextReader reader, ref bool AddToSecondary)
return yeast;
}

public Models.Fermentable ParseFermentable(XmlTextReader reader, ref bool AddAfterBoil, ref bool IsMashed)
public Models.Fermentable ParseFermentable(XmlTextReader reader, ref bool AddAfterBoil, ref bool IsMashed, ref float Amount)
{
Models.Fermentable fermentable = new Models.Fermentable();
var currentNodeName = "";
Expand Down Expand Up @@ -140,7 +140,7 @@ public Models.Fermentable ParseFermentable(XmlTextReader reader, ref bool AddAft
fermentable.FermentableType_Name = reader.Value;
break;
case "AMOUNT":
fermentable.Amount = float.Parse(reader.Value);
Amount = float.Parse(reader.Value);
break;
case "YIELD":
fermentable.Yield = float.Parse(reader.Value);
Expand Down Expand Up @@ -182,7 +182,7 @@ public Models.Fermentable ParseFermentable(XmlTextReader reader, ref bool AddAft
return fermentable;
}

public Models.Hop ParseHop(XmlTextReader reader, ref string HopUses_Name)
public Models.Hop ParseHop(XmlTextReader reader, ref string HopUses_Name, ref float Amount, ref float Time)
{
Models.Hop hop = new Models.Hop();
var currentNodeName = "";
Expand All @@ -203,7 +203,7 @@ public Models.Hop ParseHop(XmlTextReader reader, ref string HopUses_Name)
hop.Alpha = float.Parse(reader.Value);
break;
case "AMOUNT":
hop.Amount = float.Parse(reader.Value);
Amount = float.Parse(reader.Value);
break;
case "USE":
Models.HopUse hopUse = new Models.HopUse() { Name = reader.Value };
Expand All @@ -218,7 +218,7 @@ public Models.Hop ParseHop(XmlTextReader reader, ref string HopUses_Name)
HopUses_Name = reader.Value;
break;
case "TIME":
hop.Time = float.Parse(reader.Value);
Time = float.Parse(reader.Value);
break;
case "TYPE":
Models.HopType hopType = new Models.HopType() { Name = reader.Value };
Expand Down Expand Up @@ -254,7 +254,7 @@ public Models.Hop ParseHop(XmlTextReader reader, ref string HopUses_Name)
hop.Origin = reader.Value;
break;
case "SUBSTITUTES":
hop.Substitutes = reader.Value;
//hop.Substitutes = reader.Value;
break;
case "HUMULENE":
hop.Humulene = float.Parse(reader.Value);
Expand Down Expand Up @@ -429,11 +429,15 @@ public void ParseBeerXML(string fileLocation)
break;
case "HOP":
string HopUses_Name = "";
Models.Hop hop = ParseHop(reader, ref HopUses_Name);
float Amount = 0;
float Time = 0;
Models.Hop hop = ParseHop(reader, ref HopUses_Name, ref Amount, ref Time);
Models.RecipeHop recipeHop = new Models.RecipeHop();
recipeHop.Recipe_Name = recipe.Name;
recipeHop.Hop_Name = hop.Name;
recipeHop.HopUses_Name = HopUses_Name;
recipeHop.Amount = Amount;
recipeHop.Time = Time;

using (var context = new Models.ModelsContext())
{
Expand All @@ -451,14 +455,15 @@ public void ParseBeerXML(string fileLocation)
case "FERMENTABLE":
bool AddAfterBoil = false;
bool IsMashed = false;

Models.Fermentable fermentable = ParseFermentable(reader, ref AddAfterBoil, ref IsMashed);
Amount = 0;
Models.Fermentable fermentable = ParseFermentable(reader, ref AddAfterBoil, ref IsMashed, ref Amount);

Models.RecipeFermentable recipeFermentable = new Models.RecipeFermentable();
recipeFermentable.AddAfterBoil = AddAfterBoil;
recipeFermentable.IsMashed = IsMashed;
recipeFermentable.Fermentable_Name = fermentable.Name;
recipeFermentable.Recipe_Name = recipe.Name;
recipeFermentable.Amount = Amount;

using (var context = new Models.ModelsContext())
{
Expand All @@ -476,12 +481,16 @@ public void ParseBeerXML(string fileLocation)
break;
case "YEAST":
bool AddToSecondary = false;
Models.Yeast yeast = ParseYeasts(reader, ref AddToSecondary);
bool AmountIsWeight = false;
Amount = 0;
Models.Yeast yeast = ParseYeasts(reader, ref AddToSecondary, ref Amount, ref AmountIsWeight);

Models.RecipeYeast recipeYeast = new Models.RecipeYeast();
recipeYeast.AddToSecondary = AddToSecondary;
recipeYeast.Recipe_Name = recipe.Name;
recipeYeast.Yeast_Name = yeast.Name;
recipeYeast.AmountIsWeight = AmountIsWeight;
recipeYeast.Amount = Amount;

using (var context = new Models.ModelsContext())
{
Expand Down
18 changes: 4 additions & 14 deletions Brew/Brew/DBGeneration/Constraints.sql
Expand Up @@ -208,17 +208,7 @@ ADD CONSTRAINT CK_Recipe_CarbonationTemp_Range CHECK (
CarbonationTemp >= -50 AND CarbonationTemp <= 110 --Inclusive The degrees Celsius
)

ALTER TABLE RecipeFermentables
ADD IsMashed BIT DEFAULT ((0)) NOT NULL

ALTER TABLE RecipeFermentables
ADD "AddAfterBoil" BIT DEFAULT ((0)) NOT NULL

ALTER TABLE RecipeYeasts
ADD AddToSecondary BIT DEFAULT ((0)) NOT NULL

ALTER TABLE RecipeHops
ADD HopUses_Name NVARCHAR (75) NULL

ALTER TABLE RecipeHops
ADD CONSTRAINT [FK_dbo.Hop_dbo.HopUse_HopUses_Name] FOREIGN KEY ([HopUses_Name]) REFERENCES [dbo].[HopUse] ([Name])
ALTER TABLE Recipe
ADD CONSTRAINT CK_Rating_Rating_Score_Range CHECK (
Rating_Score >= 0 AND Rating_Score <= 10 --Inclusive The Score for the rating of a beer
)
2 changes: 0 additions & 2 deletions Brew/Brew/Models/FermentableModels.cs
Expand Up @@ -22,8 +22,6 @@ public class Fermentable : IEquatable<Fermentable>
public string Name { get; set; }
//[Required]
public FermentableType FermentableType { get; set; }
[Required]
public float Amount { get; set; } // Weight of the fermentable, extract or sugar in Kilograms.
[Required, Range(0.0, 100)]
public float Yield { get; set; } // Percent dry yield (fine grain) for the grain, or the raw yield by weight if this is an extract adjunct or sugar.
[Required]
Expand Down
12 changes: 5 additions & 7 deletions Brew/Brew/Models/HopModels.cs
Expand Up @@ -38,11 +38,7 @@ public class Hop : IEquatable<Hop>
[Key, StringLength(75)]
public string Name { get; set; }
[Required, Range(0.0, 100)]
public float Alpha { get; set; } // Percent alpha of hops - for example "5.5" represents 5.5% alpha
[Required]
public float Amount { get; set; } // Weight in Kilograms of the hops used in the recipe.
[Required]
public float Time { get; set; } // Meaning is dependent on the “USE”
public float Alpha { get; set; } // Percent alpha of hops - for example "5.5" represents 5.5% alpha
public HopType HopType { get; set; }
public HopForm HopForm { get; set; }
[Range(0.0, 100)]
Expand All @@ -51,7 +47,6 @@ public class Hop : IEquatable<Hop>
public float HSI { get; set; } // Hop Stability Index - defined as the percentage of hop alpha lost in 6 months of storage
[StringLength(75)]
public string Origin { get; set; } // Place of origin for the hops
public string Substitutes { get; set; } // Substitutes that can be used for this hops
[Range(0.0, 100)]
public float Humulene { get; set; } // Humulene level in percent
[Range(0.0, 100)]
Expand All @@ -69,9 +64,12 @@ public class Hop : IEquatable<Hop>

public virtual ICollection<RecipeHop> RecipeHops { get; set; }

public virtual ICollection<HopSubstitute> Substitutes { get; set; }

public Hop()
{
RecipeHops = new HashSet<RecipeHop>();
RecipeHops = new HashSet<RecipeHop>();
Substitutes = new HashSet<HopSubstitute>();
}

public override bool Equals(object obj)
Expand Down
23 changes: 23 additions & 0 deletions Brew/Brew/Models/HopSubstituteModel.cs
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;

namespace Brew.Models
{
[Table("HopSubstitute")]
public class HopSubstitute
{
[Key, Column(Order = 0), ForeignKey("Hop")]
public string Hop_Name { get; set; }
[Key, Column(Order = 1), ForeignKey("Recipe")]
public string Recipe_Name { get; set; }


public virtual Hop Hop { get; set; }
public virtual Recipe Recipe { get; set; }
}
}
2 changes: 2 additions & 0 deletions Brew/Brew/Models/ModelsContext.cs
Expand Up @@ -13,6 +13,8 @@ public ModelsContext()
: base("DefaultConnection")
{
}

public DbSet<HopSubstitute> Substitutes { get; set; }
public DbSet<Rating> Ratings { get; set; }
public DbSet<RecipeHop> RecipeHops { get; set; }
public DbSet<RecipeYeast> RecipeYeasts { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions Brew/Brew/Models/RecipeFermentableModels.cs
Expand Up @@ -16,6 +16,8 @@ public class RecipeFermentable : IEquatable<RecipeFermentable>
[Key, Column(Order = 1), ForeignKey("Fermentable")]
public string Fermentable_Name { get; set; }

[Required]
public float Amount { get; set; } // Weight of the fermentable, extract or sugar in Kilograms.
public bool IsMashed { get; set; }
public bool AddAfterBoil { get; set; } // May be TRUE if this item is normally added after the boil.

Expand Down
5 changes: 5 additions & 0 deletions Brew/Brew/Models/RecipeHopModels.cs
Expand Up @@ -22,6 +22,11 @@ public class RecipeHop : IEquatable<RecipeHop>
public virtual Hop Hop { get; set; }
public virtual Recipe Recipe { get; set; }

[Required]
public float Amount { get; set; } // Weight in Kilograms of the hops used in the recipe.
[Required]
public float Time { get; set; } // Meaning is dependent on the “USE”

public override bool Equals(object obj)
{
return Equals(obj as RecipeHop);
Expand Down
4 changes: 4 additions & 0 deletions Brew/Brew/Models/RecipeYeastModels.cs
Expand Up @@ -21,6 +21,10 @@ public class RecipeYeast : IEquatable<RecipeYeast>
public virtual Recipe Recipe { get; set; }
public virtual Yeast Yeast { get; set; }

[Required]
public float Amount { get; set; } // The amount of yeast, measured in liters. For a starter this is the size of the starter. If the flag AMOUNT_IS_WEIGHT is set to TRUE then this measurement is in kilograms and not liters.
public bool? AmountIsWeight { get; set; } // TRUE if the amount measurement is a weight measurement and FALSE if the amount is a volume measurement.

public override bool Equals(object obj)
{
return Equals(obj as RecipeYeast);
Expand Down
3 changes: 0 additions & 3 deletions Brew/Brew/Models/YeastModels.cs
Expand Up @@ -38,9 +38,6 @@ public class Yeast : IEquatable<Yeast>
public YeastType YeastType { get; set; }
//[Required]
public YeastForm YeastForm { get; set; }
[Required]
public float Amount { get; set; } // The amount of yeast, measured in liters. For a starter this is the size of the starter. If the flag AMOUNT_IS_WEIGHT is set to TRUE then this measurement is in kilograms and not liters.
public bool? AmoutIsWeight { get; set; } // TRUE if the amount measurement is a weight measurement and FALSE if the amount is a volume measurement.
[StringLength(75)]
public string Laboratory { get; set; } // The name of the laboratory that produced the yeast.
public int? ProductID { get; set; } // The manufacturer’s product ID label or number that identifies this particular strain of yeast.
Expand Down
2 changes: 1 addition & 1 deletion Brew/Brew/ViewModels/Ingredients/FermentablesViewModel.cs
Expand Up @@ -19,7 +19,7 @@ public FermentablesViewModel(uint pageNo)
{
allFermentables.Add(new FermentableViewModel
{
Amount = fermentable.Amount.ToString(),
//Amount = fermentable.Amount.ToString(), // TODO get from join table
Color = fermentable.Color.ToString(),
//AddedAfterBoiling = fermentable.AddAfterBoil.ToString(),
Yield = fermentable.Yield,
Expand Down
4 changes: 2 additions & 2 deletions Brew/Brew/ViewModels/Ingredients/HopsViewModel.cs
Expand Up @@ -20,15 +20,15 @@ public HopsViewModel(uint pageNo)
allHops.Add(new HopViewModel
{
Type = hop.HopType.ToString(),
Amount = hop.Amount,
//Amount = hop.Amount, // TODO get from join table
Alpha = hop.Alpha,
Beta = (double)hop.Beta,
PercentHumulene = (double)hop.Humulene,
PercentCaryophyllene = (double)hop.Caryophyllene,
PercentCohumulone = (double)hop.Cohumulone,
PercentMyrcene = (double)hop.Myrcene,
UsedDuring = -1,
UsageTime = TimeSpan.FromMilliseconds(hop.Time),
// UsageTime = TimeSpan.FromMilliseconds(hop.Time), TODO get from join table
Form = hop.HopForm.ToString(),
Stability = (double)hop.HSI

Expand Down
2 changes: 1 addition & 1 deletion Brew/Brew/Views/Account/Login.cshtml
Expand Up @@ -9,7 +9,7 @@
</hgroup>

<section id="loginForm">
<h2>Use a local account to log in.</h2>
<h2>Hoppin' Brew Social.</h2>
@using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl })) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
Expand Down
Binary file modified Report - CS.doc
Binary file not shown.

0 comments on commit f57d4fa

Please sign in to comment.