{"action":"created","comment":{"url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/comments/216127911","pull_request_review_id":153551203,"id":216127911,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjEyNzkxMQ==","diff_hunk":"@@ -0,0 +1,92 @@\n+const _ = require('underscore');\n+const fs = require('fs');\n+const path = require('path');\n+const XLSX = require('xlsx');\n+\n+const Base = require('./base');\n+const Cli = require('./../include/cli');\n+\n+/**\n+ * xlsx output\n+ */\n+class xlsx extends Base {\n+\n+    makeStats() {\n+        let stats = [[], []];\n+\n+        _.each(this.stats, (time, name) => {\n+            stats[0].push(name);\n+            stats[1].push(time);\n+        });\n+\n+        if (this.projects.length > 1) {\n+            _.each(this.projects, (time, name) => {\n+                stats[0].push(name);\n+                stats[1].push(time);\n+            });\n+        }\n+\n+        _.each(this.users, (time, name) => {\n+            stats[0].push(name);\n+            stats[1].push(time);\n+        });\n+\n+        this.xlsxStats = XLSX.utils.aoa_to_sheet(stats);\n+    }\n+\n+    makeIssues() {\n+        let issues = [];\n+        issues.push(this.config.get('issueColumns'));\n+        this.report.issues.forEach(issue => issues.push(this.prepare(issue, this.config.get('issueColumns'))));\n+\n+        this.xlsxIssues = XLSX.utils.aoa_to_sheet(issues);\n+    }\n+\n+    makeMergeRequests() {\n+        let mergeRequests = [];\n+        mergeRequests.push(this.config.get('mergeRequestColumns'));\n+        this.report.mergeRequests.forEach(mergeRequest => mergeRequests.push(this.prepare(mergeRequest, this.config.get('mergeRequestColumns'))));\n+\n+        this.xlsxMergeRequests = XLSX.utils.aoa_to_sheet(mergeRequests);\n+    }\n+\n+    makeRecords() {\n+        let times = [];\n+        times.push(this.config.get('recordColumns'));\n+        this.times.forEach(time => times.push(this.prepare(time, this.config.get('recordColumns'))));\n+\n+        this.xlsxRecords = XLSX.utils.aoa_to_sheet(times);\n+    }\n+\n+    toFile(file, resolve) {\n+        let fileName = path.basename(file);\n+        let extName = path.extname(file);\n+        let workbook = XLSX.utils.book_new();\n+\n+        if (this.config.get('report').includes('stats')) {\n+            XLSX.utils.book_append_sheet(workbook, this.xlsxStats, 'Stats');\n+        }\n+\n+        if (this.config.get('report').includes('issues')) {\n+            XLSX.utils.book_append_sheet(workbook, this.xlsxIssues, 'Issues');\n+        }\n+\n+        if (this.config.get('report').includes('merge_requests')) {\n+            XLSX.utils.book_append_sheet(workbook, this.xlsxMergeRequests, 'Merge Requests');\n+        }\n+\n+        if (this.config.get('report').includes('records')) {\n+            XLSX.utils.book_append_sheet(workbook, this.xlsxRecords, 'Records');\n+        }\n+\n+        XLSX.writeFile(workbook, fileName + extName);","path":"src/output/xlsx.js","position":82,"original_position":82,"commit_id":"3a1078dff2454dc227435b030fb365d4e3c4804e","original_commit_id":"3a1078dff2454dc227435b030fb365d4e3c4804e","user":{"login":"kriskbx","id":3148865,"node_id":"MDQ6VXNlcjMxNDg4NjU=","avatar_url":"https://avatars3.githubusercontent.com/u/3148865?v=4","gravatar_id":"","url":"https://api.github.com/users/kriskbx","html_url":"https://github.com/kriskbx","followers_url":"https://api.github.com/users/kriskbx/followers","following_url":"https://api.github.com/users/kriskbx/following{/other_user}","gists_url":"https://api.github.com/users/kriskbx/gists{/gist_id}","starred_url":"https://api.github.com/users/kriskbx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriskbx/subscriptions","organizations_url":"https://api.github.com/users/kriskbx/orgs","repos_url":"https://api.github.com/users/kriskbx/repos","events_url":"https://api.github.com/users/kriskbx/events{/privacy}","received_events_url":"https://api.github.com/users/kriskbx/received_events","type":"User","site_admin":false},"body":"`fileName = path.basename()` already contains the extension, so you get a double extension when saving files. Can you remove `extName` completely?","created_at":"2018-09-08T11:09:34Z","updated_at":"2018-09-08T11:09:34Z","html_url":"https://github.com/kriskbx/gitlab-time-tracker/pull/65#discussion_r216127911","pull_request_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/65","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/comments/216127911"},"html":{"href":"https://github.com/kriskbx/gitlab-time-tracker/pull/65#discussion_r216127911"},"pull_request":{"href":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/65"}}},"pull_request":{"url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/65","id":213880426,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzODgwNDI2","html_url":"https://github.com/kriskbx/gitlab-time-tracker/pull/65","diff_url":"https://github.com/kriskbx/gitlab-time-tracker/pull/65.diff","patch_url":"https://github.com/kriskbx/gitlab-time-tracker/pull/65.patch","issue_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/issues/65","number":65,"state":"open","locked":false,"title":"Add support for XLSX report output","user":{"login":"cgdobre","id":5562621,"node_id":"MDQ6VXNlcjU1NjI2MjE=","avatar_url":"https://avatars3.githubusercontent.com/u/5562621?v=4","gravatar_id":"","url":"https://api.github.com/users/cgdobre","html_url":"https://github.com/cgdobre","followers_url":"https://api.github.com/users/cgdobre/followers","following_url":"https://api.github.com/users/cgdobre/following{/other_user}","gists_url":"https://api.github.com/users/cgdobre/gists{/gist_id}","starred_url":"https://api.github.com/users/cgdobre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgdobre/subscriptions","organizations_url":"https://api.github.com/users/cgdobre/orgs","repos_url":"https://api.github.com/users/cgdobre/repos","events_url":"https://api.github.com/users/cgdobre/events{/privacy}","received_events_url":"https://api.github.com/users/cgdobre/received_events","type":"User","site_admin":false},"body":"Added support for XLSX output for reports","created_at":"2018-09-07T10:11:16Z","updated_at":"2018-09-08T11:09:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"90834e718c62a7ee4576278a2a38c5f139efe9dd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/65/commits","review_comments_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/65/comments","review_comment_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/issues/65/comments","statuses_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/statuses/3a1078dff2454dc227435b030fb365d4e3c4804e","head":{"label":"cgdobre:add-report-output-xlsx","ref":"add-report-output-xlsx","sha":"3a1078dff2454dc227435b030fb365d4e3c4804e","user":{"login":"cgdobre","id":5562621,"node_id":"MDQ6VXNlcjU1NjI2MjE=","avatar_url":"https://avatars3.githubusercontent.com/u/5562621?v=4","gravatar_id":"","url":"https://api.github.com/users/cgdobre","html_url":"https://github.com/cgdobre","followers_url":"https://api.github.com/users/cgdobre/followers","following_url":"https://api.github.com/users/cgdobre/following{/other_user}","gists_url":"https://api.github.com/users/cgdobre/gists{/gist_id}","starred_url":"https://api.github.com/users/cgdobre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgdobre/subscriptions","organizations_url":"https://api.github.com/users/cgdobre/orgs","repos_url":"https://api.github.com/users/cgdobre/repos","events_url":"https://api.github.com/users/cgdobre/events{/privacy}","received_events_url":"https://api.github.com/users/cgdobre/received_events","type":"User","site_admin":false},"repo":{"id":144716877,"node_id":"MDEwOlJlcG9zaXRvcnkxNDQ3MTY4Nzc=","name":"gitlab-time-tracker","full_name":"cgdobre/gitlab-time-tracker","owner":{"login":"cgdobre","id":5562621,"node_id":"MDQ6VXNlcjU1NjI2MjE=","avatar_url":"https://avatars3.githubusercontent.com/u/5562621?v=4","gravatar_id":"","url":"https://api.github.com/users/cgdobre","html_url":"https://github.com/cgdobre","followers_url":"https://api.github.com/users/cgdobre/followers","following_url":"https://api.github.com/users/cgdobre/following{/other_user}","gists_url":"https://api.github.com/users/cgdobre/gists{/gist_id}","starred_url":"https://api.github.com/users/cgdobre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgdobre/subscriptions","organizations_url":"https://api.github.com/users/cgdobre/orgs","repos_url":"https://api.github.com/users/cgdobre/repos","events_url":"https://api.github.com/users/cgdobre/events{/privacy}","received_events_url":"https://api.github.com/users/cgdobre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cgdobre/gitlab-time-tracker","description":"🦊 A command line interface for GitLab's time tracking feature.","fork":true,"url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker","forks_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/forks","keys_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/teams","hooks_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/hooks","issue_events_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/issues/events{/number}","events_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/events","assignees_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/assignees{/user}","branches_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/branches{/branch}","tags_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/tags","blobs_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/git/refs{/sha}","trees_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/statuses/{sha}","languages_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/languages","stargazers_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/stargazers","contributors_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/contributors","subscribers_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/subscribers","subscription_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/subscription","commits_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/commits{/sha}","git_commits_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/git/commits{/sha}","comments_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/comments{/number}","issue_comment_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/issues/comments{/number}","contents_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/contents/{+path}","compare_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/merges","archive_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/downloads","issues_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/issues{/number}","pulls_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/pulls{/number}","milestones_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/milestones{/number}","notifications_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/labels{/name}","releases_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/releases{/id}","deployments_url":"https://api.github.com/repos/cgdobre/gitlab-time-tracker/deployments","created_at":"2018-08-14T12:26:06Z","updated_at":"2018-08-14T12:26:08Z","pushed_at":"2018-09-07T09:38:52Z","git_url":"git://github.com/cgdobre/gitlab-time-tracker.git","ssh_url":"git@github.com:cgdobre/gitlab-time-tracker.git","clone_url":"https://github.com/cgdobre/gitlab-time-tracker.git","svn_url":"https://github.com/cgdobre/gitlab-time-tracker","homepage":"","size":14010,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kriskbx:master","ref":"master","sha":"181d0dd9365a310d709ead9ef4c39675005f91e4","user":{"login":"kriskbx","id":3148865,"node_id":"MDQ6VXNlcjMxNDg4NjU=","avatar_url":"https://avatars3.githubusercontent.com/u/3148865?v=4","gravatar_id":"","url":"https://api.github.com/users/kriskbx","html_url":"https://github.com/kriskbx","followers_url":"https://api.github.com/users/kriskbx/followers","following_url":"https://api.github.com/users/kriskbx/following{/other_user}","gists_url":"https://api.github.com/users/kriskbx/gists{/gist_id}","starred_url":"https://api.github.com/users/kriskbx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriskbx/subscriptions","organizations_url":"https://api.github.com/users/kriskbx/orgs","repos_url":"https://api.github.com/users/kriskbx/repos","events_url":"https://api.github.com/users/kriskbx/events{/privacy}","received_events_url":"https://api.github.com/users/kriskbx/received_events","type":"User","site_admin":false},"repo":{"id":87368273,"node_id":"MDEwOlJlcG9zaXRvcnk4NzM2ODI3Mw==","name":"gitlab-time-tracker","full_name":"kriskbx/gitlab-time-tracker","owner":{"login":"kriskbx","id":3148865,"node_id":"MDQ6VXNlcjMxNDg4NjU=","avatar_url":"https://avatars3.githubusercontent.com/u/3148865?v=4","gravatar_id":"","url":"https://api.github.com/users/kriskbx","html_url":"https://github.com/kriskbx","followers_url":"https://api.github.com/users/kriskbx/followers","following_url":"https://api.github.com/users/kriskbx/following{/other_user}","gists_url":"https://api.github.com/users/kriskbx/gists{/gist_id}","starred_url":"https://api.github.com/users/kriskbx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriskbx/subscriptions","organizations_url":"https://api.github.com/users/kriskbx/orgs","repos_url":"https://api.github.com/users/kriskbx/repos","events_url":"https://api.github.com/users/kriskbx/events{/privacy}","received_events_url":"https://api.github.com/users/kriskbx/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kriskbx/gitlab-time-tracker","description":"🦊🕘 A command line interface for GitLab's time tracking feature.","fork":false,"url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker","forks_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/forks","keys_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/teams","hooks_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/hooks","issue_events_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/issues/events{/number}","events_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/events","assignees_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/assignees{/user}","branches_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/branches{/branch}","tags_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/tags","blobs_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/git/refs{/sha}","trees_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/statuses/{sha}","languages_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/languages","stargazers_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/stargazers","contributors_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/contributors","subscribers_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/subscribers","subscription_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/subscription","commits_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/commits{/sha}","git_commits_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/git/commits{/sha}","comments_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/comments{/number}","issue_comment_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/issues/comments{/number}","contents_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/contents/{+path}","compare_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/merges","archive_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/downloads","issues_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/issues{/number}","pulls_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls{/number}","milestones_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/milestones{/number}","notifications_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/labels{/name}","releases_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/releases{/id}","deployments_url":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/deployments","created_at":"2017-04-06T00:20:58Z","updated_at":"2018-09-07T17:57:07Z","pushed_at":"2018-09-07T10:11:16Z","git_url":"git://github.com/kriskbx/gitlab-time-tracker.git","ssh_url":"git@github.com:kriskbx/gitlab-time-tracker.git","clone_url":"https://github.com/kriskbx/gitlab-time-tracker.git","svn_url":"https://github.com/kriskbx/gitlab-time-tracker","homepage":"","size":13968,"stargazers_count":137,"watchers_count":137,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":28,"open_issues":9,"watchers":137,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/65"},"html":{"href":"https://github.com/kriskbx/gitlab-time-tracker/pull/65"},"issue":{"href":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/issues/65"},"comments":{"href":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/kriskbx/gitlab-time-tracker/statuses/3a1078dff2454dc227435b030fb365d4e3c4804e"}},"author_association":"NONE"}}
{"actor":{"display_login":"kriskbx"}}