From efc9acb1061eff647dc86bf7c9fcbad4bf14f3b2 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 14 Apr 2017 18:35:45 -0400 Subject: [PATCH] Show bugs on release pages --- Project-Unite/Models/BugModels.cs | 2 +- Project-Unite/Models/Download.cs | 9 ++++ .../Views/Download/ViewRelease.cshtml | 50 ++++++++++++++++++- 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/Project-Unite/Models/BugModels.cs b/Project-Unite/Models/BugModels.cs index 0ccca4a..0e31c7e 100644 --- a/Project-Unite/Models/BugModels.cs +++ b/Project-Unite/Models/BugModels.cs @@ -127,7 +127,7 @@ public List Versions { var db = new ApplicationDbContext(); var items = new List(); - foreach(var itm in db.Downloads.OrderByDescending(x => x.PostDate)) + foreach(var itm in db.Downloads.Where(x=>x.Obsolete == false).OrderByDescending(x => x.PostDate)) { items.Add(new SelectListItem { diff --git a/Project-Unite/Models/Download.cs b/Project-Unite/Models/Download.cs index 69de79e..545e4ff 100644 --- a/Project-Unite/Models/Download.cs +++ b/Project-Unite/Models/Download.cs @@ -12,6 +12,15 @@ public class Download [Required] public string Id { get; set; } + public Bug[] OpenBugs + { + get + { + return new ApplicationDbContext().Bugs.Where(x => x.ReleaseId == this.Id && x.Open == true).ToArray(); + } + } + + [Required] public string Name { get; set; } diff --git a/Project-Unite/Views/Download/ViewRelease.cshtml b/Project-Unite/Views/Download/ViewRelease.cshtml index 56b8453..e6bc1de 100644 --- a/Project-Unite/Views/Download/ViewRelease.cshtml +++ b/Project-Unite/Views/Download/ViewRelease.cshtml @@ -30,6 +30,54 @@ } @Html.Markdown(Model.Changelog) + +

Reported bugs

+ + @if (Model.OpenBugs.Length == 0) + { +

There are no reported bugs to display.

+ } + else + { + + + + + + + + @foreach (var bug in Model.OpenBugs.OrderByDescending(x=>x.Urgency)) + { + + + + + + } +
BugUrgencyActions
+ @Html.ActionLink(bug.Name, "ViewBug", "Bugs", null, new { id=bug.Id})
+ Opened by @Html.UserLink(bug.Reporter) at @bug.ReportedAt +
+ @switch (bug.Urgency) + { + case 0: + Minor + break; + case 1: + Moderate + + break; + case 2: + Major + break; + case 3: + Critical + break; + } + + View bug +
+ }

Download

@@ -40,7 +88,7 @@

If you have any issues with this build, please let us know. Also, to find out a bit more about the build, if you haven't already, check out the details to the left!

@if (Model.Obsolete) - { + {

This build is obsolete!

We no longer support this build, and thus, any issues with this build that arise as we develop the game further will not be fixed. Consider picking up a more up-to-date build?