Skip to content

Commit

Permalink
Add option to upload median run to Google Sheets (#201 and #199?) (#203)
Browse files Browse the repository at this point in the history
* Add option to upload median run to Google Sheets (#201)
  • Loading branch information
Tim Stallmann authored and denar90 committed Jan 28, 2019
1 parent 92d3993 commit e2feb2f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface SheetsConfig {
spreadsheetId: string;
tableName: string;
clientSecret: AuthorizeCredentials;
uploadMedian?: boolean;
};
}

Expand Down

0 comments on commit e2feb2f

Please sign in to comment.