mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Fix #70; Don't break front page on nulls
This commit is contained in:
parent
ce4fbb16ec
commit
5190032029
|
@ -114,7 +114,7 @@ public async Task<FrontPage> SelectFrontPage()
|
||||||
}
|
}
|
||||||
}).Sort(sortByCompileDate).Limit(1);
|
}).Sort(sortByCompileDate).Limit(1);
|
||||||
|
|
||||||
fp.CurrentCanary = (await query.ToListAsync())[0];
|
fp.CurrentCanary = await query.FirstOrDefaultAsync();
|
||||||
|
|
||||||
query = _buildCollection.Find(new BsonDocument
|
query = _buildCollection.Find(new BsonDocument
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ public async Task<FrontPage> SelectFrontPage()
|
||||||
}
|
}
|
||||||
}).Sort(sortByCompileDate).Limit(1);
|
}).Sort(sortByCompileDate).Limit(1);
|
||||||
|
|
||||||
fp.CurrentInsider = (await query.ToListAsync())[0];
|
fp.CurrentInsider = await query.FirstOrDefaultAsync();
|
||||||
|
|
||||||
query = _buildCollection.Find(new BsonDocument
|
query = _buildCollection.Find(new BsonDocument
|
||||||
{
|
{
|
||||||
|
@ -162,7 +162,7 @@ public async Task<FrontPage> SelectFrontPage()
|
||||||
}
|
}
|
||||||
}).Sort(sortByCompileDate).Limit(1);
|
}).Sort(sortByCompileDate).Limit(1);
|
||||||
|
|
||||||
fp.CurrentRelease = (await query.ToListAsync())[0];
|
fp.CurrentRelease = await query.FirstOrDefaultAsync();
|
||||||
|
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ else
|
||||||
{
|
{
|
||||||
@class = "form-control"
|
@class = "form-control"
|
||||||
})
|
})
|
||||||
<button onclick="$('#@Html.IdFor(model => model.LeakDate)').val('@DateTime.Now.ToString("dd/MM/yyyy")');return false;" class="btn btn-success btn-block btn-reset">@VariantTerms.Front_Today</button>
|
<button onclick="$('#@Html.IdFor(model => model.LeakDate)').val('@DateTime.Now.ToShortDateString()');return false;" class="btn btn-success btn-block btn-reset">@VariantTerms.Front_Today</button>
|
||||||
@Html.ValidationMessageFor(model => model.LeakDate)
|
@Html.ValidationMessageFor(model => model.LeakDate)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
<h3>@VariantTerms.Front_LatestBuilds</h3>
|
<h3>@VariantTerms.Front_LatestBuilds</h3>
|
||||||
<div class="latest-flex">
|
<div class="latest-flex">
|
||||||
|
@if (Model.CurrentCanary != null)
|
||||||
|
{
|
||||||
<a href="@Url.Action("ViewBuild", new
|
<a href="@Url.Action("ViewBuild", new
|
||||||
{
|
{
|
||||||
Model.CurrentCanary.Id
|
Model.CurrentCanary.Id
|
||||||
|
@ -19,9 +21,12 @@
|
||||||
<div class="latest-flex-detail">
|
<div class="latest-flex-detail">
|
||||||
<p class="latest-flex-build">@(Model.CurrentCanary.MajorVersion).@(Model.CurrentCanary.MinorVersion).@(Model.CurrentCanary.Number).@(Model.CurrentCanary.Revision)</p>
|
<p class="latest-flex-build">@(Model.CurrentCanary.MajorVersion).@(Model.CurrentCanary.MinorVersion).@(Model.CurrentCanary.Number).@(Model.CurrentCanary.Revision)</p>
|
||||||
<p class="latest-flex-lab">@Model.CurrentCanary.Lab</p>
|
<p class="latest-flex-lab">@Model.CurrentCanary.Lab</p>
|
||||||
<p class="latest-flex-time">@Model.CurrentCanary.BuildTime.Value.ToString("HH:mm, dddd dd MMMM yyyy")</p>
|
<p class="latest-flex-time">@(Model.CurrentCanary.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
}
|
||||||
|
@if (Model.CurrentInsider != null)
|
||||||
|
{
|
||||||
<a href="@Url.Action("ViewBuild", new
|
<a href="@Url.Action("ViewBuild", new
|
||||||
{
|
{
|
||||||
Model.CurrentInsider.Id
|
Model.CurrentInsider.Id
|
||||||
|
@ -30,9 +35,12 @@
|
||||||
<div class="latest-flex-detail">
|
<div class="latest-flex-detail">
|
||||||
<p class="latest-flex-build">@(Model.CurrentInsider.MajorVersion).@(Model.CurrentInsider.MinorVersion).@(Model.CurrentInsider.Number).@(Model.CurrentInsider.Revision)</p>
|
<p class="latest-flex-build">@(Model.CurrentInsider.MajorVersion).@(Model.CurrentInsider.MinorVersion).@(Model.CurrentInsider.Number).@(Model.CurrentInsider.Revision)</p>
|
||||||
<p class="latest-flex-lab">@Model.CurrentInsider.Lab</p>
|
<p class="latest-flex-lab">@Model.CurrentInsider.Lab</p>
|
||||||
<p class="latest-flex-time">@Model.CurrentInsider.BuildTime.Value.ToString("HH:mm, dddd dd MMMM yyyy")</p>
|
<p class="latest-flex-time">@(Model.CurrentInsider.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
}
|
||||||
|
@if (Model.CurrentRelease != null)
|
||||||
|
{
|
||||||
<a href="@Url.Action("ViewBuild", new
|
<a href="@Url.Action("ViewBuild", new
|
||||||
{
|
{
|
||||||
Model.CurrentRelease.Id
|
Model.CurrentRelease.Id
|
||||||
|
@ -41,9 +49,10 @@
|
||||||
<div class="latest-flex-detail">
|
<div class="latest-flex-detail">
|
||||||
<p class="latest-flex-build">@(Model.CurrentRelease.MajorVersion).@(Model.CurrentRelease.MinorVersion).@(Model.CurrentRelease.Number).@(Model.CurrentRelease.Revision)</p>
|
<p class="latest-flex-build">@(Model.CurrentRelease.MajorVersion).@(Model.CurrentRelease.MinorVersion).@(Model.CurrentRelease.Number).@(Model.CurrentRelease.Revision)</p>
|
||||||
<p class="latest-flex-lab">@Model.CurrentRelease.Lab</p>
|
<p class="latest-flex-lab">@Model.CurrentRelease.Lab</p>
|
||||||
<p class="latest-flex-time">@Model.CurrentRelease.BuildTime.Value.ToString("HH:mm, dddd dd MMMM yyyy")</p>
|
<p class="latest-flex-time">@(Model.CurrentRelease.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<a href="@Url.Action("IndexPage", new
|
<a href="@Url.Action("IndexPage", new
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user