Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #70 from half-ogre/half-ogre/51-remove-build-start…
Browse files Browse the repository at this point in the history
…ed-time-ago

Remove time ago from build started description
  • Loading branch information
half-ogre committed Dec 9, 2013
2 parents 358d53f + caa6de3 commit e49ab5c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
28 changes: 28 additions & 0 deletions qed/Functions/GetGitHubBuildStatusDescription.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;

namespace qed
{
public static partial class Functions
{
internal static string GetGitHubBuildStatusDescription(Build build)
{
if (build == null) throw new ArgumentNullException("build");

var now = DateTimeOffset.UtcNow;

if (!build.Started.HasValue)
return String.Format("Build #{0} queued.", build.Id);

if (!build.Finished.HasValue)
return String.Format("Build #{0} started.", build.Id);

if (!build.Succeeded.HasValue)
return String.Format("Build #{0} finished in {1} seconds.", build.Id, build.Started.Value.Until(build.Finished.Value));

if (build.Succeeded.Value)
return String.Format("Build #{0} succeeded in {1} seconds.", build.Id, build.Started.Value.Until(build.Finished.Value));

return String.Format("Build #{0} failed in {1} seconds.", build.Id, build.Started.Value.Until(build.Finished.Value));
}
}
}
2 changes: 1 addition & 1 deletion qed/Functions/SetGitHubBuildStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static void SetGitHubBuildStatus(
build,
state,
GetBuildConfiguration,
GetBuildDescription,
GetGitHubBuildStatusDescription,
GetHost,
(token, owner, name, sha, commitState, targetUrl, description) =>
{
Expand Down
1 change: 1 addition & 0 deletions qed/qed.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Functions\CompareToPasswordHash.cs" />
<Compile Include="Functions\GetGitHubBuildStatusDescription.cs" />
<Compile Include="Functions\FailTimedOutBuilds.cs" />
<Compile Include="Functions\ToDictionary.cs" />
<Compile Include="Functions\GeneratePasswordHash.cs" />
Expand Down

0 comments on commit e49ab5c

Please sign in to comment.