{"action":"created","comment":{"url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/comments/114076875","pull_request_review_id":35518194,"id":114076875,"diff_hunk":"@@ -3,17 +3,38 @@ import Config from '../config';\n import MusitActor from './actor';\n import MusitObject from './object';\n import { Observable } from 'rxjs';\n+import moment from 'moment';\n \n class Analysis {}\n \n-Analysis.fromJsonToForm = jsonObj =>\n-  Object.keys(jsonObj).reduce(\n-    (acc, attributeName) => [\n-      ...acc,\n-      { name: attributeName, defaultValue: jsonObj[attributeName] }\n-    ],\n-    []\n+Analysis.fromJsonToForm = (\n+  json: any\n+): Array<{ name: string, defaultValue: string | boolean }> => {\n+  // auxiliary method for converting to field\n+  const toField = (name, defaultValue) => ({ name, defaultValue });\n+  // Convert json to an object of form fields\n+  const form = Object.keys(json).reduce(\n+    (acc, key) => ({ ...acc, [key]: toField(key, json[key]) }),\n+    {}\n   );\n+  // custom mapping of composite structures from json to form\n+  form.caseNumber = toField(\n+    'caseNumber',\n+    form.caseNumbers ? form.caseNumbers.defaultValue[0] : null\n+  );\n+  const restriction = form.restriction && form.restriction.defaultValue;\n+  form.restrictiona = toField('restrictions', !!restriction);\n+  if (restriction) {\n+    form.requester = toField('requester', restriction.requester);","path":"src/models/analysis.js","position":33,"original_position":33,"commit_id":"ac300271cfa3184a8357a338390d45e07be94df6","original_commit_id":"d89688598d375ac7de12fbc03a0868dd6621f51d","user":{"login":"jarlah","id":404102,"avatar_url":"https://avatars0.githubusercontent.com/u/404102?v=3","gravatar_id":"","url":"https://api.github.com/users/jarlah","html_url":"https://github.com/jarlah","followers_url":"https://api.github.com/users/jarlah/followers","following_url":"https://api.github.com/users/jarlah/following{/other_user}","gists_url":"https://api.github.com/users/jarlah/gists{/gist_id}","starred_url":"https://api.github.com/users/jarlah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarlah/subscriptions","organizations_url":"https://api.github.com/users/jarlah/orgs","repos_url":"https://api.github.com/users/jarlah/repos","events_url":"https://api.github.com/users/jarlah/events{/privacy}","received_events_url":"https://api.github.com/users/jarlah/received_events","type":"User","site_admin":false},"body":"i can take that in the  next iteration","created_at":"2017-04-30T14:40:30Z","updated_at":"2017-04-30T14:40:30Z","html_url":"https://github.com/MUSIT-Norway/musit-frontend/pull/389#discussion_r114076875","pull_request_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/389","_links":{"self":{"href":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/comments/114076875"},"html":{"href":"https://github.com/MUSIT-Norway/musit-frontend/pull/389#discussion_r114076875"},"pull_request":{"href":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/389"}}},"pull_request":{"url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/389","id":118312782,"html_url":"https://github.com/MUSIT-Norway/musit-frontend/pull/389","diff_url":"https://github.com/MUSIT-Norway/musit-frontend/pull/389.diff","patch_url":"https://github.com/MUSIT-Norway/musit-frontend/pull/389.patch","issue_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/issues/389","number":389,"state":"open","locked":false,"title":"Musark 1030 - Fixing a lot of inconsistent business logic in analysis","user":{"login":"jarlah","id":404102,"avatar_url":"https://avatars0.githubusercontent.com/u/404102?v=3","gravatar_id":"","url":"https://api.github.com/users/jarlah","html_url":"https://github.com/jarlah","followers_url":"https://api.github.com/users/jarlah/followers","following_url":"https://api.github.com/users/jarlah/following{/other_user}","gists_url":"https://api.github.com/users/jarlah/gists{/gist_id}","starred_url":"https://api.github.com/users/jarlah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarlah/subscriptions","organizations_url":"https://api.github.com/users/jarlah/orgs","repos_url":"https://api.github.com/users/jarlah/repos","events_url":"https://api.github.com/users/jarlah/events{/privacy}","received_events_url":"https://api.github.com/users/jarlah/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-04-30T13:49:52Z","updated_at":"2017-04-30T14:40:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ba5a435c8f28e2f4b5b86e5e3d597881dfefcee","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/389/commits","review_comments_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/389/comments","review_comment_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/issues/389/comments","statuses_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/statuses/ac300271cfa3184a8357a338390d45e07be94df6","head":{"label":"jarlah:MUSARK-1030","ref":"MUSARK-1030","sha":"ac300271cfa3184a8357a338390d45e07be94df6","user":{"login":"jarlah","id":404102,"avatar_url":"https://avatars0.githubusercontent.com/u/404102?v=3","gravatar_id":"","url":"https://api.github.com/users/jarlah","html_url":"https://github.com/jarlah","followers_url":"https://api.github.com/users/jarlah/followers","following_url":"https://api.github.com/users/jarlah/following{/other_user}","gists_url":"https://api.github.com/users/jarlah/gists{/gist_id}","starred_url":"https://api.github.com/users/jarlah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarlah/subscriptions","organizations_url":"https://api.github.com/users/jarlah/orgs","repos_url":"https://api.github.com/users/jarlah/repos","events_url":"https://api.github.com/users/jarlah/events{/privacy}","received_events_url":"https://api.github.com/users/jarlah/received_events","type":"User","site_admin":false},"repo":{"id":65816951,"name":"musit-frontend","full_name":"jarlah/musit-frontend","owner":{"login":"jarlah","id":404102,"avatar_url":"https://avatars0.githubusercontent.com/u/404102?v=3","gravatar_id":"","url":"https://api.github.com/users/jarlah","html_url":"https://github.com/jarlah","followers_url":"https://api.github.com/users/jarlah/followers","following_url":"https://api.github.com/users/jarlah/following{/other_user}","gists_url":"https://api.github.com/users/jarlah/gists{/gist_id}","starred_url":"https://api.github.com/users/jarlah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarlah/subscriptions","organizations_url":"https://api.github.com/users/jarlah/orgs","repos_url":"https://api.github.com/users/jarlah/repos","events_url":"https://api.github.com/users/jarlah/events{/privacy}","received_events_url":"https://api.github.com/users/jarlah/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jarlah/musit-frontend","description":null,"fork":true,"url":"https://api.github.com/repos/jarlah/musit-frontend","forks_url":"https://api.github.com/repos/jarlah/musit-frontend/forks","keys_url":"https://api.github.com/repos/jarlah/musit-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jarlah/musit-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jarlah/musit-frontend/teams","hooks_url":"https://api.github.com/repos/jarlah/musit-frontend/hooks","issue_events_url":"https://api.github.com/repos/jarlah/musit-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/jarlah/musit-frontend/events","assignees_url":"https://api.github.com/repos/jarlah/musit-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/jarlah/musit-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/jarlah/musit-frontend/tags","blobs_url":"https://api.github.com/repos/jarlah/musit-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jarlah/musit-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jarlah/musit-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/jarlah/musit-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jarlah/musit-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/jarlah/musit-frontend/languages","stargazers_url":"https://api.github.com/repos/jarlah/musit-frontend/stargazers","contributors_url":"https://api.github.com/repos/jarlah/musit-frontend/contributors","subscribers_url":"https://api.github.com/repos/jarlah/musit-frontend/subscribers","subscription_url":"https://api.github.com/repos/jarlah/musit-frontend/subscription","commits_url":"https://api.github.com/repos/jarlah/musit-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/jarlah/musit-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/jarlah/musit-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/jarlah/musit-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/jarlah/musit-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/jarlah/musit-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jarlah/musit-frontend/merges","archive_url":"https://api.github.com/repos/jarlah/musit-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jarlah/musit-frontend/downloads","issues_url":"https://api.github.com/repos/jarlah/musit-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/jarlah/musit-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/jarlah/musit-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/jarlah/musit-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jarlah/musit-frontend/labels{/name}","releases_url":"https://api.github.com/repos/jarlah/musit-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/jarlah/musit-frontend/deployments","created_at":"2016-08-16T12:08:04Z","updated_at":"2017-02-08T10:11:57Z","pushed_at":"2017-04-30T14:39:53Z","git_url":"git://github.com/jarlah/musit-frontend.git","ssh_url":"git@github.com:jarlah/musit-frontend.git","clone_url":"https://github.com/jarlah/musit-frontend.git","svn_url":"https://github.com/jarlah/musit-frontend","homepage":null,"size":3261,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"MUSIT-Norway:master","ref":"master","sha":"6a29b499aab9b800a0e9357e7f15d39b5c876d4f","user":{"login":"MUSIT-Norway","id":17343809,"avatar_url":"https://avatars1.githubusercontent.com/u/17343809?v=3","gravatar_id":"","url":"https://api.github.com/users/MUSIT-Norway","html_url":"https://github.com/MUSIT-Norway","followers_url":"https://api.github.com/users/MUSIT-Norway/followers","following_url":"https://api.github.com/users/MUSIT-Norway/following{/other_user}","gists_url":"https://api.github.com/users/MUSIT-Norway/gists{/gist_id}","starred_url":"https://api.github.com/users/MUSIT-Norway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MUSIT-Norway/subscriptions","organizations_url":"https://api.github.com/users/MUSIT-Norway/orgs","repos_url":"https://api.github.com/users/MUSIT-Norway/repos","events_url":"https://api.github.com/users/MUSIT-Norway/events{/privacy}","received_events_url":"https://api.github.com/users/MUSIT-Norway/received_events","type":"Organization","site_admin":false},"repo":{"id":65810519,"name":"musit-frontend","full_name":"MUSIT-Norway/musit-frontend","owner":{"login":"MUSIT-Norway","id":17343809,"avatar_url":"https://avatars1.githubusercontent.com/u/17343809?v=3","gravatar_id":"","url":"https://api.github.com/users/MUSIT-Norway","html_url":"https://github.com/MUSIT-Norway","followers_url":"https://api.github.com/users/MUSIT-Norway/followers","following_url":"https://api.github.com/users/MUSIT-Norway/following{/other_user}","gists_url":"https://api.github.com/users/MUSIT-Norway/gists{/gist_id}","starred_url":"https://api.github.com/users/MUSIT-Norway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MUSIT-Norway/subscriptions","organizations_url":"https://api.github.com/users/MUSIT-Norway/orgs","repos_url":"https://api.github.com/users/MUSIT-Norway/repos","events_url":"https://api.github.com/users/MUSIT-Norway/events{/privacy}","received_events_url":"https://api.github.com/users/MUSIT-Norway/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MUSIT-Norway/musit-frontend","description":"Norwegian university museums IT organization (MUSIT); cultural history and natural history database with store integration","fork":false,"url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend","forks_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/forks","keys_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/teams","hooks_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/hooks","issue_events_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/events","assignees_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/tags","blobs_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/languages","stargazers_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/stargazers","contributors_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/contributors","subscribers_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/subscribers","subscription_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/subscription","commits_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/merges","archive_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/downloads","issues_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/labels{/name}","releases_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/deployments","created_at":"2016-08-16T10:17:16Z","updated_at":"2017-03-02T22:38:28Z","pushed_at":"2017-04-30T14:39:54Z","git_url":"git://github.com/MUSIT-Norway/musit-frontend.git","ssh_url":"git@github.com:MUSIT-Norway/musit-frontend.git","clone_url":"https://github.com/MUSIT-Norway/musit-frontend.git","svn_url":"https://github.com/MUSIT-Norway/musit-frontend","homepage":"","size":2858,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":2,"forks":5,"open_issues":2,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/389"},"html":{"href":"https://github.com/MUSIT-Norway/musit-frontend/pull/389"},"issue":{"href":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/issues/389"},"comments":{"href":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/issues/389/comments"},"review_comments":{"href":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/389/comments"},"review_comment":{"href":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/pulls/389/commits"},"statuses":{"href":"https://api.github.com/repos/MUSIT-Norway/musit-frontend/statuses/ac300271cfa3184a8357a338390d45e07be94df6"}}}}
{"actor":{"display_login":"jarlah"}}