From 02e53ce3747c945d008cf5349c2fe5d96bf291e4 Mon Sep 17 00:00:00 2001 From: Tim Stallmann Date: Tue, 22 Jan 2019 17:24:22 -0500 Subject: [PATCH 1/2] Add option to upload median run to Google Sheets (#201) --- lib/index.ts | 9 ++++++++- readme.md | 3 ++- types/types.ts | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 7acf5ea..c6a333c 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -102,7 +102,14 @@ class PWMetrics { this.displayOutput(results.median); } else if (this.flags.submit) { const sheets = new Sheets(this.sheets, this.clientSecret); - await sheets.appendResults(results.runs); + + if (this.sheets.options.uploadMedian) { + results.median = this.findMedianRun(results.runs); + await sheets.appendResults([results.median,]); + } + else { + await sheets.appendResults(results.runs); + } } await this.outputData(results); diff --git a/readme.md b/readme.md index 039a56a..a0f8f8c 100644 --- a/readme.md +++ b/readme.md @@ -154,7 +154,8 @@ module.exports = { type: 'GOOGLE_SHEETS', // sheets service type. Available types: GOOGLE_SHEETS options: { spreadsheetId: 'sheet_id', - tableName: 'data' + tableName: 'data', + uploadMedian: false // not required, set to true if you want to upload only the median run } }, clientSecret: { diff --git a/types/types.ts b/types/types.ts index 9a84ac9..1953e9e 100644 --- a/types/types.ts +++ b/types/types.ts @@ -7,6 +7,7 @@ export interface SheetsConfig { spreadsheetId: string; tableName: string; clientSecret: AuthorizeCredentials; + uploadMedian?: boolean; }; } From cd066a9dc876aca0869c454872bcf0606fc4e00e Mon Sep 17 00:00:00 2001 From: Artem Denysov Date: Fri, 25 Jan 2019 08:06:17 -0500 Subject: [PATCH 2/2] Update lib/index.ts Co-Authored-By: timstallmann --- lib/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.ts b/lib/index.ts index c6a333c..4f8c27b 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -105,7 +105,7 @@ class PWMetrics { if (this.sheets.options.uploadMedian) { results.median = this.findMedianRun(results.runs); - await sheets.appendResults([results.median,]); + await sheets.appendResults([results.median]); } else { await sheets.appendResults(results.runs);