diff --git a/functions/src/mappers/github/status.mapper.ts b/functions/src/mappers/github/status.mapper.ts
index a39578079..08bd91966 100644
--- a/functions/src/mappers/github/status.mapper.ts
+++ b/functions/src/mappers/github/status.mapper.ts
@@ -1,6 +1,9 @@
+import { firestore } from 'firebase-admin';
+
export interface BuildTimes {
context: string;
time: number;
+ createdAt: firestore.Timestamp;
}
export interface GitHubPullRequestStatusInput {
@@ -15,8 +18,8 @@ export interface GitHubPullRequestStatusModel {
id: number;
state: string;
context: string;
- createdAt: string;
- updatedAt: string;
+ createdAt: firestore.Timestamp;
+ updatedAt: firestore.Timestamp;
}
export class GitHubPullRequestStatusMapper {
@@ -25,8 +28,8 @@ export class GitHubPullRequestStatusMapper {
id: input.id,
state: input.state,
context: input.context,
- createdAt: input.created_at,
- updatedAt: input.updated_at,
+ createdAt: firestore.Timestamp.fromDate(new Date(input.created_at)),
+ updatedAt: firestore.Timestamp.fromDate(new Date(input.updated_at)),
};
}
}
diff --git a/functions/src/repository/pull-request.ts b/functions/src/repository/pull-request.ts
index ec1eed8d6..3582dce70 100644
--- a/functions/src/repository/pull-request.ts
+++ b/functions/src/repository/pull-request.ts
@@ -18,9 +18,9 @@ export const getPullRequestBuildTime: any = (statuses: GitHubPullRequestStatusMo
uniqueContexts.map((context: string) => {
const filteredStatus: GitHubPullRequestStatusModel[] = statuses.filter((status: GitHubPullRequestStatusModel) => status.context === context);
if (filteredStatus.length > 0) {
- const buildTime: number = Math.floor(new Date(filteredStatus[0].updatedAt).getTime()
- - new Date(filteredStatus[filteredStatus.length - 1].updatedAt).getTime()) / 1000;
- buildTimes.push({ context: context, time: buildTime });
+ const buildTime: number = Math.floor((filteredStatus[0].updatedAt.toDate().getTime()
+ - filteredStatus[filteredStatus.length - 1].updatedAt.toDate().getTime())) / 1000;
+ buildTimes.push({ context: context, time: buildTime, createdAt: filteredStatus[0].createdAt });
}
});
return buildTimes;
diff --git a/web/src/app/projects/build-history/build-history.component.html b/web/src/app/projects/build-history/build-history.component.html
index b5f43ba23..163fc6161 100644
--- a/web/src/app/projects/build-history/build-history.component.html
+++ b/web/src/app/projects/build-history/build-history.component.html
@@ -26,10 +26,15 @@
Time
+ Duration
{{ element.buildTimes[0].time }} seconds
Created
+ {{ element.buildTimes[0].createdAt.toDate() | timeAgo}}
+