Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions App/StackExchange.DataExplorer/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ public ActionResult Index()

ViewData["LastUpdate"] = Current.DB.Query<DateTime?>("SELECT MAX(LastPost) FROM Sites").FirstOrDefault();

// sp_Refresh_Database https://gist.github.com/NickCraver/f009ab6e0d6b85ae54f6
// will create a [name]_Temp database when the restore starts
// we rely on that implementation detail to determine if
// a restore of data is in progress
ViewData["UpdateStatus"] = Current.DB.Query<string>(@"SELECT TOP 1 CASE WHEN [name] LIKE '%_Temp' THEN 'restoring' ELSE NULL END [status]
FROM [sys].[databases]
ORDER BY [create_date] DESC").FirstOrDefault();

return View(sites);
}

Expand Down
2 changes: 1 addition & 1 deletion App/StackExchange.DataExplorer/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@{this.SetPageTitle("Stack Exchange Data Explorer");}
<div id="mainbar-full">
<div class="info-wrapper">
<span class="info">Data updated @((ViewData["LastUpdate"] as DateTime?).ToRelativeTime())</span>
<span class="info">Data updated @((ViewData["LastUpdate"] as DateTime?).ToRelativeTime()) <i>@(ViewData["UpdateStatus"])</i></span>
</div>
<ul class="site-list">
@foreach (Site site in Model)
Expand Down