{"action":"created","comment":{"url":"https://api.github.com/repos/VS-work/live-starter/pulls/comments/183781389","pull_request_review_id":114844065,"id":183781389,"diff_hunk":"@@ -1,36 +1,119 @@\n import { Component, OnInit } from '@angular/core';\n-import { Subscription } from 'rxjs/Subscription';\n-import { FanProfileService } from './fan-profile.service';\n+\n+import * as moment from 'moment';\n+\n+import { ActivatedRoute, Router } from '@angular/router';\n+import { UserService } from '../user-service/user.service';\n+import { User } from '../user-service/user.model';\n+import { ShowService } from '../shared/show-service/show.service';\n+import { Show } from '../shared/show-service/show.model';\n+import { ShowInfo } from '../shared/show-info/info.interface';\n+import { StatisticsItem } from '../shared/statistics/statistics.interface';\n+import { STATISTICS_FOLLOWERS, STATISTICS_LIKES, STATISTICS_SHOWS,\n+  STATISTICS_VIEWERS } from '../shared/statistics/statistics-types.model';\n+import { EventByQuery } from '../shared/show-service/event-by-query.interface';\n \n @Component({\n   selector: 'app-fan-profile-component',\n   templateUrl: './fan-profile.component.html',\n-  styleUrls: ['./fan-profile.component.css']\n+  styleUrls: ['./fan-profile.component.scss']\n })\n \n export class FanProfileComponent implements OnInit {\n-  public fanProfileService: FanProfileService;\n-  public fanProfileServiceSubscribe: Subscription;\n+  user: User;\n+  joinDate: string;\n+  dateOfBirth: string;\n+  backedShows: ShowInfo[] = [];\n+  attendedShows: ShowInfo[] = [];\n+  userStatistics: StatisticsItem[] = [];\n+  query: EventByQuery;\n \n-  public user: any;\n-  public radioModel: string;\n+  constructor(private route: ActivatedRoute,\n+              private router: Router,\n+              private userService: UserService,\n+              private showService: ShowService) {\n \n-  public constructor(fanProfileService: FanProfileService) {\n-    this.fanProfileService = fanProfileService;\n   }\n \n-  public ngOnInit(): void {\n-    this.radioModel = 'permonth';\n+  ngOnInit() {\n+    this.route.queryParams\n+      .subscribe(params => {\n+        if (!params.id) {\n+          this.router.navigate(['/']);\n \n-    this.fanProfileServiceSubscribe = this.fanProfileService.getUser()\n-      .subscribe((res: any): void => {\n-        if (res.error) {\n-          console.error(res.error);\n-          return;\n+          return undefined;\n         }\n \n-        const user: any[] = res.data;\n-        this.user = user;\n+        const userSubscription = this.userService.getUser({_id: params.id});\n+\n+        userSubscription.subscribe(user => {\n+          this.user = user;\n+          this.setJoinandBirthDate();\n+          this.userStatistics = [\n+            {...STATISTICS_VIEWERS, ...{value: this.user.statistics.viewers}},\n+            {...STATISTICS_LIKES, ...{value: this.user.statistics.likes.liked}},\n+            {...STATISTICS_FOLLOWERS, ...{value: this.user.statistics.followers}},\n+            {...STATISTICS_SHOWS, ...{value: this.user.shows.owned}}\n+          ];\n+          this.query = {\n+            findByBuyers: this.user._id,\n+            findByCompleted: false,\n+            exceptByCreator: this.user._id\n+          };\n+        }, err => {\n+          console.error('something went wrong: ', err);\n+        });\n       });\n   }\n+\n+  setJoinandBirthDate(): void {\n+    this.joinDate = this.user.joinDate\n+      ? moment(this.user.joinDate).format('dddd, MMMM DD YYYY')\n+      : undefined;\n+\n+    this.dateOfBirth = this.user.dateOfBirth\n+      ? moment(this.user.dateOfBirth).format('dddd, MMMM DD YYYY')\n+      : undefined;\n+  }\n+\n+  getBackedShows(): void | undefined {\n+    if (this.backedShows.length) {\n+      return undefined;\n+    }\n+\n+    const query: EventByQuery = {...this.query, ...{findByCompleted: false}};\n+\n+    const backedShowsSubscription = this.showService.getEventsListByQuery(query);\n+    backedShowsSubscription\n+      .subscribe(res => {\n+        this.backedShows = res.map(show => this.getShowInfo(show));\n+      }, err => {\n+        console.error('something went wrong: ', err);\n+      });\n+  }\n+\n+  getAttendedShows(): void | undefined {","path":"src/fan-profile/fan-profile.component.ts","position":113,"original_position":113,"commit_id":"9657b9cd9e73fafb841ef5e0adf9ff0b6ce04071","original_commit_id":"9657b9cd9e73fafb841ef5e0adf9ff0b6ce04071","user":{"login":"Ugmaxie","id":7901557,"avatar_url":"https://avatars0.githubusercontent.com/u/7901557?v=4","gravatar_id":"","url":"https://api.github.com/users/Ugmaxie","html_url":"https://github.com/Ugmaxie","followers_url":"https://api.github.com/users/Ugmaxie/followers","following_url":"https://api.github.com/users/Ugmaxie/following{/other_user}","gists_url":"https://api.github.com/users/Ugmaxie/gists{/gist_id}","starred_url":"https://api.github.com/users/Ugmaxie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ugmaxie/subscriptions","organizations_url":"https://api.github.com/users/Ugmaxie/orgs","repos_url":"https://api.github.com/users/Ugmaxie/repos","events_url":"https://api.github.com/users/Ugmaxie/events{/privacy}","received_events_url":"https://api.github.com/users/Ugmaxie/received_events","type":"User","site_admin":false},"body":"void. undefined... as above","created_at":"2018-04-24T15:39:25Z","updated_at":"2018-04-24T15:41:51Z","html_url":"https://github.com/VS-work/live-starter/pull/85#discussion_r183781389","pull_request_url":"https://api.github.com/repos/VS-work/live-starter/pulls/85","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/VS-work/live-starter/pulls/comments/183781389"},"html":{"href":"https://github.com/VS-work/live-starter/pull/85#discussion_r183781389"},"pull_request":{"href":"https://api.github.com/repos/VS-work/live-starter/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/VS-work/live-starter/pulls/85","id":183471865,"html_url":"https://github.com/VS-work/live-starter/pull/85","diff_url":"https://github.com/VS-work/live-starter/pull/85.diff","patch_url":"https://github.com/VS-work/live-starter/pull/85.patch","issue_url":"https://api.github.com/repos/VS-work/live-starter/issues/85","number":85,"state":"open","locked":false,"title":"feat(fan profile): #83 is ready for test;","user":{"login":"DmitriyLitvinov","id":11669993,"avatar_url":"https://avatars2.githubusercontent.com/u/11669993?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyLitvinov","html_url":"https://github.com/DmitriyLitvinov","followers_url":"https://api.github.com/users/DmitriyLitvinov/followers","following_url":"https://api.github.com/users/DmitriyLitvinov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyLitvinov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyLitvinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyLitvinov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyLitvinov/orgs","repos_url":"https://api.github.com/users/DmitriyLitvinov/repos","events_url":"https://api.github.com/users/DmitriyLitvinov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyLitvinov/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-23T15:26:40Z","updated_at":"2018-04-24T15:41:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae5711a1e134929d81b5859939a0ce0492b0a51c","assignee":{"login":"DmitriyLitvinov","id":11669993,"avatar_url":"https://avatars2.githubusercontent.com/u/11669993?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyLitvinov","html_url":"https://github.com/DmitriyLitvinov","followers_url":"https://api.github.com/users/DmitriyLitvinov/followers","following_url":"https://api.github.com/users/DmitriyLitvinov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyLitvinov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyLitvinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyLitvinov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyLitvinov/orgs","repos_url":"https://api.github.com/users/DmitriyLitvinov/repos","events_url":"https://api.github.com/users/DmitriyLitvinov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyLitvinov/received_events","type":"User","site_admin":false},"assignees":[{"login":"DmitriyLitvinov","id":11669993,"avatar_url":"https://avatars2.githubusercontent.com/u/11669993?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyLitvinov","html_url":"https://github.com/DmitriyLitvinov","followers_url":"https://api.github.com/users/DmitriyLitvinov/followers","following_url":"https://api.github.com/users/DmitriyLitvinov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyLitvinov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyLitvinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyLitvinov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyLitvinov/orgs","repos_url":"https://api.github.com/users/DmitriyLitvinov/repos","events_url":"https://api.github.com/users/DmitriyLitvinov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyLitvinov/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":775751124,"url":"https://api.github.com/repos/VS-work/live-starter/labels/Need%20development%20review","name":"Need development review","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/VS-work/live-starter/pulls/85/commits","review_comments_url":"https://api.github.com/repos/VS-work/live-starter/pulls/85/comments","review_comment_url":"https://api.github.com/repos/VS-work/live-starter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/VS-work/live-starter/issues/85/comments","statuses_url":"https://api.github.com/repos/VS-work/live-starter/statuses/9657b9cd9e73fafb841ef5e0adf9ff0b6ce04071","head":{"label":"VS-work:feat-fan-page","ref":"feat-fan-page","sha":"9657b9cd9e73fafb841ef5e0adf9ff0b6ce04071","user":{"login":"VS-work","id":19818002,"avatar_url":"https://avatars0.githubusercontent.com/u/19818002?v=4","gravatar_id":"","url":"https://api.github.com/users/VS-work","html_url":"https://github.com/VS-work","followers_url":"https://api.github.com/users/VS-work/followers","following_url":"https://api.github.com/users/VS-work/following{/other_user}","gists_url":"https://api.github.com/users/VS-work/gists{/gist_id}","starred_url":"https://api.github.com/users/VS-work/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VS-work/subscriptions","organizations_url":"https://api.github.com/users/VS-work/orgs","repos_url":"https://api.github.com/users/VS-work/repos","events_url":"https://api.github.com/users/VS-work/events{/privacy}","received_events_url":"https://api.github.com/users/VS-work/received_events","type":"Organization","site_admin":false},"repo":{"id":78652331,"name":"live-starter","full_name":"VS-work/live-starter","owner":{"login":"VS-work","id":19818002,"avatar_url":"https://avatars0.githubusercontent.com/u/19818002?v=4","gravatar_id":"","url":"https://api.github.com/users/VS-work","html_url":"https://github.com/VS-work","followers_url":"https://api.github.com/users/VS-work/followers","following_url":"https://api.github.com/users/VS-work/following{/other_user}","gists_url":"https://api.github.com/users/VS-work/gists{/gist_id}","starred_url":"https://api.github.com/users/VS-work/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VS-work/subscriptions","organizations_url":"https://api.github.com/users/VS-work/orgs","repos_url":"https://api.github.com/users/VS-work/repos","events_url":"https://api.github.com/users/VS-work/events{/privacy}","received_events_url":"https://api.github.com/users/VS-work/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VS-work/live-starter","description":"live-starter","fork":false,"url":"https://api.github.com/repos/VS-work/live-starter","forks_url":"https://api.github.com/repos/VS-work/live-starter/forks","keys_url":"https://api.github.com/repos/VS-work/live-starter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VS-work/live-starter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VS-work/live-starter/teams","hooks_url":"https://api.github.com/repos/VS-work/live-starter/hooks","issue_events_url":"https://api.github.com/repos/VS-work/live-starter/issues/events{/number}","events_url":"https://api.github.com/repos/VS-work/live-starter/events","assignees_url":"https://api.github.com/repos/VS-work/live-starter/assignees{/user}","branches_url":"https://api.github.com/repos/VS-work/live-starter/branches{/branch}","tags_url":"https://api.github.com/repos/VS-work/live-starter/tags","blobs_url":"https://api.github.com/repos/VS-work/live-starter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VS-work/live-starter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VS-work/live-starter/git/refs{/sha}","trees_url":"https://api.github.com/repos/VS-work/live-starter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VS-work/live-starter/statuses/{sha}","languages_url":"https://api.github.com/repos/VS-work/live-starter/languages","stargazers_url":"https://api.github.com/repos/VS-work/live-starter/stargazers","contributors_url":"https://api.github.com/repos/VS-work/live-starter/contributors","subscribers_url":"https://api.github.com/repos/VS-work/live-starter/subscribers","subscription_url":"https://api.github.com/repos/VS-work/live-starter/subscription","commits_url":"https://api.github.com/repos/VS-work/live-starter/commits{/sha}","git_commits_url":"https://api.github.com/repos/VS-work/live-starter/git/commits{/sha}","comments_url":"https://api.github.com/repos/VS-work/live-starter/comments{/number}","issue_comment_url":"https://api.github.com/repos/VS-work/live-starter/issues/comments{/number}","contents_url":"https://api.github.com/repos/VS-work/live-starter/contents/{+path}","compare_url":"https://api.github.com/repos/VS-work/live-starter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VS-work/live-starter/merges","archive_url":"https://api.github.com/repos/VS-work/live-starter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VS-work/live-starter/downloads","issues_url":"https://api.github.com/repos/VS-work/live-starter/issues{/number}","pulls_url":"https://api.github.com/repos/VS-work/live-starter/pulls{/number}","milestones_url":"https://api.github.com/repos/VS-work/live-starter/milestones{/number}","notifications_url":"https://api.github.com/repos/VS-work/live-starter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VS-work/live-starter/labels{/name}","releases_url":"https://api.github.com/repos/VS-work/live-starter/releases{/id}","deployments_url":"https://api.github.com/repos/VS-work/live-starter/deployments","created_at":"2017-01-11T15:31:37Z","updated_at":"2018-04-17T09:22:53Z","pushed_at":"2018-04-24T14:03:26Z","git_url":"git://github.com/VS-work/live-starter.git","ssh_url":"git@github.com:VS-work/live-starter.git","clone_url":"https://github.com/VS-work/live-starter.git","svn_url":"https://github.com/VS-work/live-starter","homepage":null,"size":3666,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":10,"watchers":0,"default_branch":"development"}},"base":{"label":"VS-work:development","ref":"development","sha":"1d0dec880fae8166b9d24673ad208e53cbd97594","user":{"login":"VS-work","id":19818002,"avatar_url":"https://avatars0.githubusercontent.com/u/19818002?v=4","gravatar_id":"","url":"https://api.github.com/users/VS-work","html_url":"https://github.com/VS-work","followers_url":"https://api.github.com/users/VS-work/followers","following_url":"https://api.github.com/users/VS-work/following{/other_user}","gists_url":"https://api.github.com/users/VS-work/gists{/gist_id}","starred_url":"https://api.github.com/users/VS-work/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VS-work/subscriptions","organizations_url":"https://api.github.com/users/VS-work/orgs","repos_url":"https://api.github.com/users/VS-work/repos","events_url":"https://api.github.com/users/VS-work/events{/privacy}","received_events_url":"https://api.github.com/users/VS-work/received_events","type":"Organization","site_admin":false},"repo":{"id":78652331,"name":"live-starter","full_name":"VS-work/live-starter","owner":{"login":"VS-work","id":19818002,"avatar_url":"https://avatars0.githubusercontent.com/u/19818002?v=4","gravatar_id":"","url":"https://api.github.com/users/VS-work","html_url":"https://github.com/VS-work","followers_url":"https://api.github.com/users/VS-work/followers","following_url":"https://api.github.com/users/VS-work/following{/other_user}","gists_url":"https://api.github.com/users/VS-work/gists{/gist_id}","starred_url":"https://api.github.com/users/VS-work/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VS-work/subscriptions","organizations_url":"https://api.github.com/users/VS-work/orgs","repos_url":"https://api.github.com/users/VS-work/repos","events_url":"https://api.github.com/users/VS-work/events{/privacy}","received_events_url":"https://api.github.com/users/VS-work/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VS-work/live-starter","description":"live-starter","fork":false,"url":"https://api.github.com/repos/VS-work/live-starter","forks_url":"https://api.github.com/repos/VS-work/live-starter/forks","keys_url":"https://api.github.com/repos/VS-work/live-starter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VS-work/live-starter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VS-work/live-starter/teams","hooks_url":"https://api.github.com/repos/VS-work/live-starter/hooks","issue_events_url":"https://api.github.com/repos/VS-work/live-starter/issues/events{/number}","events_url":"https://api.github.com/repos/VS-work/live-starter/events","assignees_url":"https://api.github.com/repos/VS-work/live-starter/assignees{/user}","branches_url":"https://api.github.com/repos/VS-work/live-starter/branches{/branch}","tags_url":"https://api.github.com/repos/VS-work/live-starter/tags","blobs_url":"https://api.github.com/repos/VS-work/live-starter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VS-work/live-starter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VS-work/live-starter/git/refs{/sha}","trees_url":"https://api.github.com/repos/VS-work/live-starter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VS-work/live-starter/statuses/{sha}","languages_url":"https://api.github.com/repos/VS-work/live-starter/languages","stargazers_url":"https://api.github.com/repos/VS-work/live-starter/stargazers","contributors_url":"https://api.github.com/repos/VS-work/live-starter/contributors","subscribers_url":"https://api.github.com/repos/VS-work/live-starter/subscribers","subscription_url":"https://api.github.com/repos/VS-work/live-starter/subscription","commits_url":"https://api.github.com/repos/VS-work/live-starter/commits{/sha}","git_commits_url":"https://api.github.com/repos/VS-work/live-starter/git/commits{/sha}","comments_url":"https://api.github.com/repos/VS-work/live-starter/comments{/number}","issue_comment_url":"https://api.github.com/repos/VS-work/live-starter/issues/comments{/number}","contents_url":"https://api.github.com/repos/VS-work/live-starter/contents/{+path}","compare_url":"https://api.github.com/repos/VS-work/live-starter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VS-work/live-starter/merges","archive_url":"https://api.github.com/repos/VS-work/live-starter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VS-work/live-starter/downloads","issues_url":"https://api.github.com/repos/VS-work/live-starter/issues{/number}","pulls_url":"https://api.github.com/repos/VS-work/live-starter/pulls{/number}","milestones_url":"https://api.github.com/repos/VS-work/live-starter/milestones{/number}","notifications_url":"https://api.github.com/repos/VS-work/live-starter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VS-work/live-starter/labels{/name}","releases_url":"https://api.github.com/repos/VS-work/live-starter/releases{/id}","deployments_url":"https://api.github.com/repos/VS-work/live-starter/deployments","created_at":"2017-01-11T15:31:37Z","updated_at":"2018-04-17T09:22:53Z","pushed_at":"2018-04-24T14:03:26Z","git_url":"git://github.com/VS-work/live-starter.git","ssh_url":"git@github.com:VS-work/live-starter.git","clone_url":"https://github.com/VS-work/live-starter.git","svn_url":"https://github.com/VS-work/live-starter","homepage":null,"size":3666,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":10,"watchers":0,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/VS-work/live-starter/pulls/85"},"html":{"href":"https://github.com/VS-work/live-starter/pull/85"},"issue":{"href":"https://api.github.com/repos/VS-work/live-starter/issues/85"},"comments":{"href":"https://api.github.com/repos/VS-work/live-starter/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/VS-work/live-starter/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/VS-work/live-starter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/VS-work/live-starter/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/VS-work/live-starter/statuses/9657b9cd9e73fafb841ef5e0adf9ff0b6ce04071"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Ugmaxie"}}