Skip to content

Commit

Permalink
implement basic navigation and start associating assignment data with…
Browse files Browse the repository at this point in the history
… users and implement random generation of givens from assignment templates.
  • Loading branch information
symbyte committed May 26, 2015
1 parent 4770bed commit 5452733
Show file tree
Hide file tree
Showing 20 changed files with 707 additions and 45 deletions.
6 changes: 6 additions & 0 deletions UCOHomeworkTool.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{47C8C0
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UCOHomeworkTool.test", "UCOHomeworkTool.test\UCOHomeworkTool.test.csproj", "{4EFA08DF-3E1A-4644-B75A-68035684784B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -22,6 +24,10 @@ Global
{E47078C4-E8DF-4BAF-9DC6-40A4ACD09E7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E47078C4-E8DF-4BAF-9DC6-40A4ACD09E7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E47078C4-E8DF-4BAF-9DC6-40A4ACD09E7F}.Release|Any CPU.Build.0 = Release|Any CPU
{4EFA08DF-3E1A-4644-B75A-68035684784B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EFA08DF-3E1A-4644-B75A-68035684784B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EFA08DF-3E1A-4644-B75A-68035684784B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EFA08DF-3E1A-4644-B75A-68035684784B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
36 changes: 36 additions & 0 deletions UCOHomeworkTool.test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UCOHomeworkTool.test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UCOHomeworkTool.test")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d5e468ee-3e2d-4534-a59a-48eaa31c7a43")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
83 changes: 83 additions & 0 deletions UCOHomeworkTool.test/UCOHomeworkTool.test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4EFA08DF-3E1A-4644-B75A-68035684784B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UCOHomeworkTool.test</RootNamespace>
<AssemblyName>UCOHomeworkTool.test</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="UnitTest1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
14 changes: 14 additions & 0 deletions UCOHomeworkTool.test/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UCOHomeworkTool.test
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
}
}
2 changes: 1 addition & 1 deletion UCOHomeworkTool/Content/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -4532,7 +4532,7 @@ fieldset[disabled] .navbar-default .btn-link:focus {
background-color: transparent;
}
.navbar-inverse .navbar-toggle .icon-bar {
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(178, 219, 241, 0.5);
}
.navbar-inverse .navbar-collapse,
.navbar-inverse .navbar-form {
Expand Down
38 changes: 28 additions & 10 deletions UCOHomeworkTool/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,57 @@
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using UCOHomeworkTool.Models;
using Microsoft.AspNet.Identity;
using System.Data.Entity.Migrations;
using UCOHomeworkTool.Migrations;

namespace UCOHomeworkTool.Controllers
{
[Authorize]
public class HomeController : Controller
{
[Authorize]
public ActionResult Index()
{
return View();
var userId = User.Identity.GetUserId();
using(var db = new ApplicationDbContext())
{
var user = db.Users.Find(userId);
var userCourses = user.Courses;
return View(userCourses.ToList());
}
}
public void DebugDB()
{
var configuration = new Configuration();
var migrator = new DbMigrator(configuration);
migrator.Update();
}
[Authorize]
public ActionResult Assignment(int id)
{
using (var database = new ApplicationDbContext())
using (var db = new ApplicationDbContext())
{
var assignmentModel = database.Assignments.Include("Problems").SingleOrDefault(x => x.Id == id);
var assignmentModel = db.Assignments.Include("Problems").SingleOrDefault(x => x.Id == id);
var problemsModel = assignmentModel.Problems;
foreach (var prob in problemsModel)
{
database.Entry(prob).Collection("Givens").Load();
database.Entry(prob).Collection("Responses").Load();
db.Entry(prob).Collection("Givens").Load();
db.Entry(prob).Collection("Responses").Load();
}
return PartialView(problemsModel.ToList());
}
}
public ActionResult _Sidebar()
public ActionResult Course(int id)
{

var userId = User.Identity.GetUserId();
using (var db = new ApplicationDbContext())
{
var assignmentList = db.Assignments.ToList();
return PartialView(assignmentList);
var assignmentList = db.Assignments.Where(x => x.Course.Id == id && x.Student.Id == userId).ToList();
return View(assignmentList);
}

}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace UCOHomeworkTool.Migrations
{
using System;
using System.Data.Entity.Migrations;

public partial class addTemplatesAndStudentToAssignment : DbMigration
{
public override void Up()
{
DropForeignKey("dbo.Assignments", "Course_Id", "dbo.Courses");
AddColumn("dbo.Assignments", "Course_Id1", c => c.Int());
AddColumn("dbo.Assignments", "Course_Id2", c => c.Int());
AddColumn("dbo.Assignments", "Student_Id", c => c.String(maxLength: 128));
AddColumn("dbo.Givens", "minRange", c => c.Double());
AddColumn("dbo.Givens", "maxRange", c => c.Double());
AddColumn("dbo.Givens", "Discriminator", c => c.String(nullable: false, maxLength: 128));
CreateIndex("dbo.Assignments", "Course_Id1");
CreateIndex("dbo.Assignments", "Course_Id2");
CreateIndex("dbo.Assignments", "Student_Id");
AddForeignKey("dbo.Assignments", "Course_Id1", "dbo.Courses", "Id");
AddForeignKey("dbo.Assignments", "Student_Id", "dbo.AspNetUsers", "Id");
AddForeignKey("dbo.Assignments", "Course_Id2", "dbo.Courses", "Id");
}

public override void Down()
{
DropForeignKey("dbo.Assignments", "Course_Id2", "dbo.Courses");
DropForeignKey("dbo.Assignments", "Student_Id", "dbo.AspNetUsers");
DropForeignKey("dbo.Assignments", "Course_Id1", "dbo.Courses");
DropIndex("dbo.Assignments", new[] { "Student_Id" });
DropIndex("dbo.Assignments", new[] { "Course_Id2" });
DropIndex("dbo.Assignments", new[] { "Course_Id1" });
DropColumn("dbo.Givens", "Discriminator");
DropColumn("dbo.Givens", "maxRange");
DropColumn("dbo.Givens", "minRange");
DropColumn("dbo.Assignments", "Student_Id");
DropColumn("dbo.Assignments", "Course_Id2");
DropColumn("dbo.Assignments", "Course_Id1");
AddForeignKey("dbo.Assignments", "Course_Id", "dbo.Courses", "Id");
}
}
}
Loading

0 comments on commit 5452733

Please sign in to comment.